-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add global options to
dispatchMulti
commands per
#198 , #128 , request by @ZoomRmc, and probably others. This is a big commit. The main work was: - Adding `iterators ids` & `hasId` & using in `parseHelps`, `parseShorts`, and `dupBlock` - Adding 2 large sections in the main monster dispatchGen macro This commit also: - Adds a single-command example as test/Vars.nim - Updates `test/FullyAutoMulti.nim` & `test/FullyAutoMulti.cf` with a new global `xx` - Updates reference output test/ref and gitignore for new test prog - Makes -d:debugMergeParams more useful and more completely used (since this helped update `test/FullyAutoMulti.nim` for global opts in cfs) - Updates test/PassValues to have a blank `vars` slot
- Loading branch information
Showing
11 changed files
with
150 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
when not declared(addFloat): import std/formatfloat | ||
var bo_go = 1 | ||
|
||
proc demo(be_ta=2.0, verb=false, item="", args: seq[string]) = | ||
## demo entry point with varied, meaningless parameters and a global. A Nim | ||
## invocation might be: `bogo=2; demo(@[ "hi", "ho" ])` corresponding to the | ||
## CL invocation "demo --bogo=2 hi ho" (assuming executable is named "demo"). | ||
echo "bogo:", boGo, " beta:", beta, " verb:", verb, " item:", item | ||
for i, arg in args: echo "positional[", i, "]: ", arg | ||
|
||
when isMainModule: import cligen; dispatch demo, vars = @["bOgo"], | ||
short={"b-ogo": 'z', "b-eta": '\0'}, | ||
help={"bOGO": "growth constant", "be-ta": "shrink target"} |
Oops, something went wrong.
f584710
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great news!
I really like that you call a 150/44 commit "big", btw.
f584710
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may not be so big in "absolute delta terms", but it does make
macro dispatchGen
that much more unwieldy. Or, erm, I mean, if I put on my marketing hat "I meant that it's BIG functionality!" { or "flavor" if it were a food, maybe. ;-) }