Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
This commit is contained in:
parent
2365b5250e
commit
792a03b756
1 changed files with 6 additions and 10 deletions
|
|
@ -2266,16 +2266,12 @@ iterator walkDir*(dir: string; relative = false, checkDir = false):
|
|||
## / fileA2.txt
|
||||
##
|
||||
## and this code:
|
||||
##
|
||||
## .. code-block:: Nim
|
||||
## for kind, path in walkDir("dirA"):
|
||||
## echo(path)
|
||||
##
|
||||
## produce this output (but not necessarily in this order!)::
|
||||
## dirA/dirB
|
||||
## dirA/dirC
|
||||
## dirA/fileA1.txt
|
||||
## dirA/fileA2.txt
|
||||
runnableExamples("-r:off"):
|
||||
import std/[strutils, sugar]
|
||||
# note: order is not guaranteed
|
||||
# this also works at compile time
|
||||
assert collect(for k in walkDir("dirA"): k.path).join(" ") ==
|
||||
"dirA/dirB dirA/dirC dirA/fileA2.txt dirA/fileA1.txt"
|
||||
##
|
||||
## See also:
|
||||
## * `walkPattern iterator <#walkPattern.i,string>`_
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue