Skip to content

How to find out with option was triggered #51

Closed
@anabellchan

Description

@anabellchan

I'm wondering if there's an elegant way of knowing which option has been set, so that a proper method can be called. For example:

        p.Setup<List<string>>("a", "addproducts")                      
            .Callback(items => arguments.NewNumbers = items);
        p.Setup<List<string>>("r", "removeproducts")                   
            .Callback(items => arguments.RemoveNumbers = items);
        p.Parse(args);

        if (arguments.NewNumbers != null)
            return ConfirmProductNumbers(arguments);
        else if (arguments.RemoveNumbers != null)
            return ConfirmProductNumbers(arguments);

Thanks for your time.

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