1

I am trying to implement logic using this library: I have the verb write, and options by this scheme:

write (-md [-p|-s] [-t]) | (-txt [-v]) - where '|' - means or (only -p OR -s is accepted (but not necessary as shown by '[]') when using -md)

Is there easy way to implement this? or should I split this to separate verbs?

Borys Fursov
  • 548
  • 2
  • 5
  • 15

1 Answers1

0

Sorry for answering own question but it would be helpful to someone else (source):

You can use use SetName argument while declaring OptionAttribute:

internal class Options
{
    [Option("username", SetName = "auth")]
    public string Username { get; set; }

    [Option("password", SetName = "auth")]
    public string Password { get; set; }

    [Option("guestaccess", SetName = "guest")]
    public bool GuestAccess { get; set; }
}

Now username and password can be used together, but guestaccess is alone within "guest" set, so it can not be used with options from other sets.

Borys Fursov
  • 548
  • 2
  • 5
  • 15