google / google/argh

Negative switches

Open
#150 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2k
Forks
102
PR merge metrics
No merged PRs in 30d

Description

My project has a use case for negative switch flags. E.g:

--action // Sets args.action to true
--noaction // Sets args.action to false

Yes, we could add the two flags ourselves, but then we'd have to handle the parsing logic and possibility of conflicts manually, and we'd have to implement it for every switch or else be inconsistent in our UX.

I would rather see a negative flag added as part of the macro for the switch type automatically, and have integrated checks to ensure the positive and negative aren't both included.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.