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:
##
## .. code-block:: nim
## # inside /some/path/
## withDir "foo":
## # inside foo
## #back to last dir
var curDir = getCurrentDir()
## # move to /some/path/foo/
## # back in /some/path/
let curDir = getCurrentDir()
try:
cd(dir)
body
finally:
cd(curDir)
proc writeTask(name, desc: string) =
if desc.len > 0:
var spaces = " "