[std/os] split and re-export (#20593)

* [std/os] split and export
* move to private modules
* fixes docs and tests

Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
This commit is contained in:
ringabout 2022-10-20 13:58:29 +08:00 • committed by GitHub
commit f6a002c8a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 2251 additions and 2047 deletions

View file

@ -22,8 +22,9 @@ when declared(math.signbit):
# ditto
from std/math as math3 import signbit
from std/envvars import getEnv, existsEnv, delEnv, putEnv, envPairs
from std/os import dirExists, fileExists, walkDir, getAppFilename
from std/os import walkDir, getAppFilename, dirExists, fileExists
from std/times import cpuTime
from std/hashes import hash
@ -44,6 +45,8 @@ template mathop(op) {.dirty.} =
template osop(op) {.dirty.} =
registerCallback(c, "stdlib.os." & astToStr(op), `op Wrapper`)
template oscommonop(op) {.dirty.} =
registerCallback(c, "stdlib.oscommon." & astToStr(op), `op Wrapper`)
template envvarsop(op) {.dirty.} =
registerCallback(c, "stdlib.envvars." & astToStr(op), `op Wrapper`)
@ -226,8 +229,8 @@ proc registerAdditionalOps*(c: PCtx) =
wrap1s(existsEnv, envvarsop)
wrap2svoid(putEnv, envvarsop)
wrap1svoid(delEnv, envvarsop)
wrap1s(dirExists, osop)
wrap1s(fileExists, osop)
wrap1s(dirExists, oscommonop)
wrap1s(fileExists, oscommonop)
wrapDangerous(writeFile, ioop)
wrap1s(readFile, ioop)
wrap2si(readLines, ioop)