Open Simonl9l opened 2 years ago
stumbled today over the same issue. wanted to set my options properly and change <> to [] funny as options are not required anyway and i had to implement support for required options myself using std. Required annotation
[CommandOption("-n|--name <NAME>")]
[Description("name of configuration object")]
[Required]
public string Name { get; set; }
Facing the same issue with this command option:
[CommandOption("--app-id [APPID]")]
public Guid AppId { get; init; } = Guid.Empty;
Please provide a workaround.
If an option has an optional value, the data type must implement IFlagValue
.
[CommandOption("--app-id [APPID]")]
public FlagValue<Guid> AppId { get; init; } = Guid.Empty;
Are you sure that --app-id
should be settable without a value? Otherwise I would suggest --app-id <APPID>
which tells Spectre.Console that the option requires the value APPID
.
Information
Describe the bug
Im looking to have an Option that will accept a list of strings, but also in the case that no string are provided it acts a flag similar to a
CommandOption
with bool?The Error is obscure at best. I've also tried with
string[] OptionList
with same results.The error message here is completely un-helpful!
Please upvote :+1: this issue if you are interested in it.