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

support dictionary types for arguments #251

Open
Tracked by #318
drewburlingame opened this issue Apr 10, 2020 · 1 comment
Open
Tracked by #318

support dictionary types for arguments #251

drewburlingame opened this issue Apr 10, 2020 · 1 comment

Comments

@drewburlingame
Copy link
Collaborator

drewburlingame commented Apr 10, 2020

Picocli has some good conventions for this: arrays_collections_maps & split_regex

Some additional considerations:

Use the same split properties from #250

For operands, the dictionary has the same rules as a list. There can be only one and it's at the end. List or Dictionary, but not both.

How do we show this in help?

Do we support null values? key1=value1,key2=,key3=value3

@drewburlingame drewburlingame added the up-for-grabs Curated tasks specifically for new contributors (see https://up-for-grabs.net ) label Apr 17, 2020
@drewburlingame drewburlingame removed the up-for-grabs Curated tasks specifically for new contributors (see https://up-for-grabs.net ) label May 14, 2020
@drewburlingame
Copy link
Collaborator Author

This feature will be complicated to add. Since a dictionary contains two types, key & value, it does not play well with the existing ArgumentTypeDescriptors which take an IArgument. Some of the descriptors need access to the Arity for the argument for parsing logic. In the case of bool, Arity is used to determine if the bool is a flag. Creating a KeyValueArgumentTypeDescriptor is easy enough but it cannot, in turn, call the other type descriptors to parse the type. I looked at adding ITypeInfo overloads but then Arity is not available for bool. Adding both IArgument and ITypeInfo can create confusion because the argument arity may not apply to the ITypeInfo being passed in.

Possibly we create a ITupleComponentArgumentTypeDescriptor interface and if a type does not implement it, then it can't be used in dictionaries. This does not feel elegant and it's an interface devs have to remember to implement. On the plus side, it's clear why you're adding it and what the inputs are. I don't think it's the right approach and I'm only mentioning it in the spirit of talking through ideas.

@drewburlingame drewburlingame added this to the CommandDotNet 5.0.0 milestone Jun 20, 2020
@drewburlingame drewburlingame removed this from the CommandDotNet 5.0.0 milestone Jun 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant