You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently multiple values per option are not supported, e.g. --option value1 value2.
Trying to add an option with a template like this (e.g. [CommandOption("--option <value1> <value2>")]) results in a "Multiple option values are not supported" error.
Describe the solution you'd like
Allow defining multiple option values via the template. Ideally it would validate/enforce the arity (so with the example template above it would be mandatory to provide two values).
It could also allow repeated values under a single option flag (so you could run --option value1 value2 value3 value4 instead of --option value1 value2 --option value3 value4). This might be problematic though, it could get awkward and create unexpected results for users since you would need to somehow terminate the option so it knows when to stop capturing values.
Describe alternatives you've considered
Option arrays - I can't use this because I have an array typed command argument, so that captures the option values instead
IDictionary/ILookup typed options - this is my current workaround, but it's not ideal because this creates a breaking change in my application as the values have to be separated with an equals now instead of a space. There also doesn't appear to be a way to escape the equals, so it breaks if you provide a value that contains one.
Additional context
I only found out about the IDictionary/ILookup solution from another issue - it would be good to include this alongside more detail on the template syntax in the documentation!
Please upvote 👍 this issue if you are interested in it.
The text was updated successfully, but these errors were encountered:
Currently you have to use --option value1 --option value2 --option value3 where you are suggesting being able to use --option value1 value2 value3?
I was just trying this and ran into the problems and realized I couldn't do it this way. small quality of life thing I guess, but certainly cleaner if you have a lot of values.
Thanks @jamerst, this looks like a cracking suggestion. Zero promise to timeline, but if this sits unassigned long enough, I will get around to looking at it myself.
Is your feature request related to a problem? Please describe.
Currently multiple values per option are not supported, e.g.
--option value1 value2
.Trying to add an option with a template like this (e.g.
[CommandOption("--option <value1> <value2>")]
) results in a "Multiple option values are not supported" error.This is the only thing preventing me from migrating from
System.CommandLine
, which supports this feature by allowing you to define the arity of an option: https://learn.microsoft.com/en-us/dotnet/standard/commandline/syntax#argument-arity.Describe the solution you'd like
Allow defining multiple option values via the template. Ideally it would validate/enforce the arity (so with the example template above it would be mandatory to provide two values).
It could also allow repeated values under a single option flag (so you could run
--option value1 value2 value3 value4
instead of--option value1 value2 --option value3 value4
). This might be problematic though, it could get awkward and create unexpected results for users since you would need to somehow terminate the option so it knows when to stop capturing values.Describe alternatives you've considered
IDictionary/ILookup
typed options - this is my current workaround, but it's not ideal because this creates a breaking change in my application as the values have to be separated with an equals now instead of a space. There also doesn't appear to be a way to escape the equals, so it breaks if you provide a value that contains one.Additional context
I only found out about the
IDictionary/ILookup
solution from another issue - it would be good to include this alongside more detail on the template syntax in the documentation!Please upvote 👍 this issue if you are interested in it.
The text was updated successfully, but these errors were encountered: