Skip to content

Specifying that an Option requires another Option #3

@ericnewton76

Description

@ericnewton76

Issue by st1led
Tuesday Apr 09, 2013 at 09:55 GMT
Originally opened as gsscoder/commandline#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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions