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:
|
||||
##
|
||||
## .. 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 = " "
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue