-
I had a look through the documentation and examples but couldn't see anything relevant. In my application I want to have a list of actions to be performed by one of the commands, where each action is represented as something like: type Action = object
name, cmd, args: string And the proc passed to cligen's dispatch is something like: proc runActions(a: seq[Action]) = discard
import cligen
dispatch(runActions) In practice these will probably be written out into a config file and merged in using Is this possible? Should I just have a separate config file and handle all this separately to cligen? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I do mention it in the README, but If you want a really worked out example you could look at how lc uses |
Beta Was this translation helpful? Give feedback.
-
Also, if it is ok to be a single command line argument but maybe with commas (,), colons (:), or something, then you can define your own whole new on-the-CLI syntax with an (in-scope of |
Beta Was this translation helpful? Give feedback.
I do mention it in the README, but
test/InitOb.nim
may also be helpful to get started. The essential logic ofinitFromCL
is to generate an object initializer from any command-line like data (seq[string]
, basically). I'd bet you can adapt that to your purposes.If you want a really worked out example you could look at how lc uses
cligen
.lc
actually merges settings from config files, the command line and dynamically from per-listed-directory saved dot files called ".lc" (it has to scan a directory anyway - it just loads that if it notices it). This latter feature allows Unix to be sort of smart like Windows remembering the last "format" for folder contents..It's more manual but also more p…