Support global/flexible position-independent command-line options#216
Open
fadeevab wants to merge 1 commit intogoogle:masterfrom
Open
Support global/flexible position-independent command-line options#216fadeevab wants to merge 1 commit intogoogle:masterfrom
fadeevab wants to merge 1 commit intogoogle:masterfrom
Conversation
It make argh to be user-friendly, e.g. it's useful for --verbose/-v options 1. #[argh(global)] on the top level command make all its option to be position-independent. 2. The top-level parent options are passed down the subcommand parsing recursion. 3. If a switch not found, it's being searched in the parent's options.
Contributor
Author
|
@elipsitz Hi, I believe this feature is long overdue. Could you please take a look? |
Contributor
|
@fadeevab I’m not a maintainer of this library, I think you meant to tag someone else. |
Contributor
Author
Contributor
Author
|
@erickt I updated the motivation for the PR with the examples: Before After |
Contributor
Author
|
@erickt What are your overall thoughts? Should it make sense? Or do you have the least changes policy now? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It makes
arghto support "global arguments" like--verbose/-voptions, which are position-independent and subcommand-independent.Motivation
Most competitors like
clapsupport "flexible" arguments positioned in any place of the command line, whilearghfeels pretty much limited in this case. In contrast,arghis more limited and typically expects global options to appear before any subcommand, which often feels unnatural and clunky.Before
After
Algorithm
#[argh(global)]on the top-level command makes all its options position-independent.