dotnet / dotnet/command-line-api
How do I get values of unmatched tokens in a Command Handler?
- Dominant language
- C#
- Stars
- 3.7k
- Forks
- 428
- PR merge metrics
- No merged PRs in 30d
Description
I have a situation where I would like a user to be able to supply values for arbitrary options for a particular command. The option-value pairs will then be turned into a json object to pass through to our API. We don't know what all these options will be at compile time.
E.g. myapi entity update --entity=Thing --id=123 --prop1=val --prop2=42
where --prop1, --prop2 are arbitrary.
I had thought I could get the InvocationContext in my command handler, from that get the ParseResult, and then find the UnmatchedTokens. However, this only gives me the token names, not their values.
Is there a way of getting the token values too?
Contributor guide
Assessment
This issue has not been assessed yet.