Update nimscript withDir doc example (#19776)
This commit is contained in:
parent
8c100a37b9
commit
61c1142667
1 changed files with 4 additions and 4 deletions
|
|
@ -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 = " "
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue