Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3-state support - Option with [HasDefaultValue] that has a default value defined still requires the value #149

Open
Simonl9l opened this issue Jul 6, 2024 · 0 comments

Comments

@Simonl9l
Copy link

Simonl9l commented Jul 6, 2024

per #31 (comment) - I seem be missing something but the note says

NOTE: Option defined as a property is treated as required by default. If you want a non-required Option to have a default value, mark it with HasDefaultValue attribute.

if would be great to have:

 public record MyCommandOptions : ICommandParameterSet
  {
      
      [Option('T', Description = "a default 3 state option")]
      [HasDefaultValue]
      public string ThreeStateWithDefault { get; set; } = "";

...
}

such that once can just specify -T or --three-state-with-default with out a following value, and the default value would be used. The option then acts as a switch (like a bool) and can have a user value supplied is needed that overrides the default.

Currently we need to also supply a value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant