Specifying that an Option requires another Option
See original GitHub issueIssue by st1led Tuesday Apr 09, 2013 at 09:55 GMT _Originally opened as https://github.com/gsscoder/commandline/issues/76_
Hi everybody, is there a way in CommandLine (I guess in a way similar to what is done with mutually exclusive properties) to specify that an option requires another option to be set? This is a short example:
[Option('v', "verbose",
Required = false,
DefaultValue = false,
HelpText = "Prints log messages.")]
public bool Verbose { get; set; }
[Option('o', "optional-operation",
Required = false,
DefaultValue = false,
HelpText = "Performs an operation (a.k.a. \"does something\") in the code.")]
public bool PerformOperation { get; set; }
[Option('t', "time-limit",
Required = false,
DefaultValue = false,
HelpText = "Requires option -o. Specifies a time limit for the optional operation")]
public int OperationTimeLimit { get; set; }
In this scenario, one would want to allow command line arguments like -o
and -vot
but not -vt
or -t
for instance, since in the latter the option -t
is specified without -o
. Is this currently possible in CommandLine?
Regards, Stefano
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:11 (9 by maintainers)
Top Results From Across the Web
Click Command Line Interfaces: Make options required if ...
This can be done by building a custom class derived from click.Option , and in that class over riding the click.Option.handle_parse_result() ...
Read more >Options — Click Documentation (8.1.x)
The most basic option is a value option. These options accept one argument which is a value. If no type is provided, the...
Read more >optparse — Parser for command line options
Each Option instance represents a set of synonymous command-line option strings, e.g. -f and --file . You can specify any number of short...
Read more >How to define commands in System.CommandLine
Learn how to define commands, options, and arguments by using the System.Commandline library.
Read more >Basic Options - Clikt
Options are added to commands by defining a property delegate with the option function. Basic Options¶. The default option takes one value of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So… how do we do this? I can’t see anything in the wiki that indicates that this feature is available.
Why is this issue closed? Is there anyway to do it now that is not documented?