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

Support overriding the default negated name of a boolean flag. #13

Open
wibling opened this issue Jun 2, 2015 · 3 comments
Open

Support overriding the default negated name of a boolean flag. #13

wibling opened this issue Jun 2, 2015 · 3 comments

Comments

@wibling
Copy link

wibling commented Jun 2, 2015

It would be great to be able to use the args package in contexts where the naming convetion for negated flags are different which requires overriding the default negated flag name (--no-).

This could e.g. be done by adding an optional negatedName parameter to the addFlag method.

@seaneagan
Copy link

Could you give an example? Is it still a prefix, or does it replace the whole name?

@wibling
Copy link
Author

wibling commented Jun 2, 2015

I was thinking it should just replace the entire negated name.

Something like

parser.addFlag('fast', negatedName: 'slow')

which results in the --slow flags being the opposite of the --fast which in some cases are better than the default --no-fast. This would also allow changing the prefix, by e.g.

parser.addFlag('foo', negatedName: 'nofoo');

giving --nofoo instead of --no-foo.

@wibling
Copy link
Author

wibling commented Jun 3, 2015

I just took a look at the code and the way it is structured today seems like it would be much simpler to support a new prefix that overriding the full name.

Solving the second use case above by supporting a new negated prefix would be great too. Completely overriding negated flag names could come as an additional improvement later.

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