Update nimscript withDir doc example (#19776)

This commit is contained in:
huantian 2022-05-08 02:54:25 -07:00 • committed by GitHub
commit 61c1142667
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -342,17 +342,17 @@ template withDir*(dir: string; body: untyped): untyped =
## Usage example: ## Usage example:
## ##
## .. code-block:: nim ## .. code-block:: nim
## # inside /some/path/
## withDir "foo": ## withDir "foo":
## # inside foo ## # move to /some/path/foo/
## #back to last dir ## # back in /some/path/
var curDir = getCurrentDir() let curDir = getCurrentDir()
try: try:
cd(dir) cd(dir)
body body
finally: finally:
cd(curDir) cd(curDir)
proc writeTask(name, desc: string) = proc writeTask(name, desc: string) =
if desc.len > 0: if desc.len > 0:
var spaces = " " var spaces = " "