summary refs log tree commit diff stats
path: root/lib/system
diff options
context:
space:
mode:
authorhuantian <davidtianli@gmail.com>2022-05-08 02:54:25 -0700
committerGitHub <noreply@github.com>2022-05-08 11:54:25 +0200
commit61c1142667fabec11a7440b0404ce5688cad54d2 (patch)
tree1f71319269094d453f89b3a6f0c743f55e6b5111 /lib/system
parent8c100a37b93607806acec51733fe5e2fda392d44 (diff)
downloadNim-61c1142667fabec11a7440b0404ce5688cad54d2.tar.gz
Update nimscript `withDir` doc example (#19776)
Diffstat (limited to 'lib/system')
-rw-r--r--lib/system/nimscript.nim8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/system/nimscript.nim b/lib/system/nimscript.nim
index 5d1916c7f..0b49ea2e7 100644
--- a/lib/system/nimscript.nim
+++ b/lib/system/nimscript.nim
@@ -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 = " "