Closed 0xACE closed 4 years ago
Yeah...You have to use a string literal in the template/macro calls themselves. I think that can maybe be addressed with some kind of static[T]
work, but that feature of Nim is also often pretty iffy/touchy. PRs welcome if you want to try. But for now you can just write your strings inline. (You probably can't do a "string expression" either..just a big literal, though triple quoted strings do work fine.)
Also, if you put a big double-hash/sharp/number/pound '##' at the top of the module, you may be able to use docFromModuleOf
as in test/MultiMultiMulti.nim
. And you might also have more luck with a let
than a const
. test/FullyAutoMulti.nim
does a let docLine =..
and later uses doc=docLine
for dispatchMulti
. I don't think I've tried that with initFromCL
.
Just as a more local note here than in my comment for https://github.com/c-blake/cligen/commit/83f5d51277e0d9d72c1ddf9483042d4ca9bd2eb0, to have any hope of working the syntax for a const short
would need to be ammended to:
const appShort = {"output": 'f'}.toTable
and similarly for the help
parameter to things like dispatch
.
Also, someone really needs to go through every parameter to make them work with typed values as well as just literals. PRs welcome.
(And once all parameters can be handled this way, a single omnibus new test/PassValues.nim
should probably test that they work.)
Using nim v0.20.0 and cligen-0.9.31.
and then running it as:
myapp -h
doesn't display the content of stringDescription of this app
string, but rather just the variable nameappsummary
and
myapp -f example
doesn't work asappshort
doesn't get applied toshort