Commit 7af04aca94b0b450ce35a68137f2e67f0f3b7e4a
1 parent
7be5e09d
Exported parseArguments for easier testing
Showing
1 changed file
with
2 additions
and
2 deletions
lapp.nim
| @@ -220,7 +220,7 @@ proc closeFiles() {.noconv.} = | @@ -220,7 +220,7 @@ proc closeFiles() {.noconv.} = | ||
| 220 | if nfiles == 0: return | 220 | if nfiles == 0: return |
| 221 | for i in 1..nfiles: files[i].close() | 221 | for i in 1..nfiles: files[i].close() |
| 222 | 222 | ||
| 223 | -proc parseArguments(usage: string, args: seq[string]): Table[string,PValue] = | 223 | +proc parseArguments*(usage: string, args: seq[string]): Table[string,PValue] = |
| 224 | var | 224 | var |
| 225 | vars = initTable[string,PValue]() | 225 | vars = initTable[string,PValue]() |
| 226 | n = len(args) - 1 | 226 | n = len(args) - 1 |
| @@ -360,7 +360,7 @@ proc parse*(usage: string): Table[string,PValue] = | @@ -360,7 +360,7 @@ proc parse*(usage: string): Table[string,PValue] = | ||
| 360 | 360 | ||
| 361 | when isMainModule: | 361 | when isMainModule: |
| 362 | var args = parse""" | 362 | var args = parse""" |
| 363 | - head [flags] [file1, file2 ...] [outfile] | 363 | + head [flags] file [out] |
| 364 | -n: (default 10) number of lines | 364 | -n: (default 10) number of lines |
| 365 | -v,--verbose: (bool...) verbosity level | 365 | -v,--verbose: (bool...) verbosity level |
| 366 | -a,--alpha useless parm | 366 | -a,--alpha useless parm |