iffy / nim-argparse

Argument parsing for Nim
MIT License
120 stars 8 forks source link

Question: Is it possible to disable/remove leading hyphen for a specific command? #87

Closed rilysh closed 1 year ago

rilysh commented 1 year ago

Hello! I'm wondering if it's possible to disable or remove the leading hyphen (- or --) when using nim-argparse? For example, instead of doing mycmd --help, is it possible to parse arguments like mycmd help? Quite a stupid question, but I couldn't find a direct note on this in the docs. Although there's a test folder I wouldn't be able to sort it out.

Thank you.

iffy commented 1 year ago

If you want the available choices for an argument to be enforced by argparse, you could use subcommand with something like command("help"):

Or if you want to accept any free-form string, you can use arg("name") then read the value of name.

Does that help?

rilysh commented 1 year ago

The second option seems to work for me. Thank you! Since it's solved, I'll close the issue now :)