-
Notifications
You must be signed in to change notification settings - Fork 401
Replace | with or when searching for Argument value #1053
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
Conversation
This allows the CommandHandler to be registered with `fileOrString` for an Argument named `File|String`. dotnet#1051
This is a pretty cool idea. I worry that string-based conventions like this can be a bit hard to discover, but in this case, not knowing about it wouldn't get in the way. Not knowing about the name-based matching in general, on the other hand, has been the most common pitfall in our design, thus #1012. Adding @Keboo and @KathleenDollard for their thoughts. |
No real objection from me but it would be nice to see some tests on this. |
@Keboo Will look to add tests in the coming days 😀 |
Hey - any chance of a review now I've added some tests? Thanks |
@@ -36,7 +36,7 @@ public static class CommandResultExtensions | |||
{ | |||
foreach (var argument in commandResult.Command.Arguments) | |||
{ | |||
if (valueName.IsMatch(argument.Name)) | |||
if (valueName.IsMatch(argument.Name) || valueName.IsMatch(argument.Name.Replace("|","or"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change should maybe be moved to the IsMatch
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I had considered not doing to before to allow the or with and without the replacement. After realising that a |
is invalid in a parameter name - this shouldn't cause any breaking changes.
Can this be reviewed again, please? |
This allows the CommandHandler to be registered with
fileOrString
for an Argument namedFile|String
.#1051