Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help doesn't check keys are valid #53

Closed
timotheecour opened this issue Nov 28, 2018 · 3 comments
Closed

help doesn't check keys are valid #53

timotheecour opened this issue Nov 28, 2018 · 3 comments

Comments

@timotheecour
Copy link
Contributor

proc main(foo = "myfoo") = discard
dispatch(main, help = {"foo2": "help msg"})

this should give compiler error (foo2 instead of foo) but doesn't

(btw, haven't answered yet to your other answers, it's on my TODO list, thanks for the detailed answers so far!)

@c-blake
Copy link
Owner

c-blake commented Nov 28, 2018

Yeah. I've been aware of that one forever. There's a line in my TODO.md about it already. It may date back to the origins of TODO.md, even. :-)

@timotheecour
Copy link
Contributor Author

(and btw, thanks for this project again, happily helping to convert some projects to cligen, eg nimterop/nimterop#21)

@c-blake
Copy link
Owner

c-blake commented Nov 28, 2018

Cool. Let me know what you think about setByParse being a table vs. a seq[(paramName, unparsedValue)]. I am kind of leaning toward the latter with a provided in/contains operator if Nim can't do string in seq[(string,T)] already.

It would be even nicer to go all the way to seq[(paramName, parsedValueVariant)], but I don't think we could use variants and still let CLI authors add their own types via custom argParse/argHelp definitions. Though I did my best to do enums/sets/seqs/etc., I'm sure there will be a need for custom types. Maybe I'm missing something about some kind of "Any" type or some other approach in Nim, though. Very open to ideas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants