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

Proposal: Enhance Utility command argument validation #16686

Phrohdoh opened this issue Jun 11, 2019 · 0 comments


None yet
1 participant
Copy link

commented Jun 11, 2019

Adding an out string errorMessage parameter to IUtilityCommand.ValidateArguments would allow us to print out a more helpful error message when a command is invoked with invalid arguments.

This wouldn't be a perfect implementation, but would, I believe, improve the user experience a bit.

A downside to this is that all commands would need to explicitly set errorMessage = null somewhere in the body of ValidateArguments if there is no error to report. I believe that is a small price to pay for the benefit this could bring.

Imagine a utility command that added two numbers.

If you run it currently with invalid arguments, signaled by ValidateArguments returning false, you would see a message like invalid arguments for --add-two.

If we made this change and the ValidateArguments impl for AddTwoUtilityCommand were to set errorMessage = "Argument 1 was not a number" (for example) we could then print something like invalid arguments for --add-two: Argument 1 was not a number.

@Phrohdoh Phrohdoh added the Utility label Jun 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.