Accept only one argument when deleting a gist#3021
Conversation
There was a problem hiding this comment.
Thank you! This looks good, but I'm wondering whether we can do a tiny bit better! When no arguments are passed to gist delete, we now lose the descriptive error message cannot delete: gist argument required. Furthermore, there are more commands in our codebase that use cmdutil.MinimumArgs when they in fact want to verify that exactly 1 argument is required.
What do you think about creating a new helper cmdutil.ExactArgs(num, message) that would print the message if there aren't enough arguments and print something like "too many arguments" when the argument length exceeds num? In both cases, the returned error type should be of the type *cmdutil.FlagError.
Then, you could go over current usage of cmdutil.MinimumArgs and check whether that should be switched over to ExactArgs instead.
|
Sure let me mull over it. |
|
@mislav I thought the |
mislav
left a comment
There was a problem hiding this comment.
Thank you! This looks great; just minor corrections needed
@mislav added the corrections |
mislav
left a comment
There was a problem hiding this comment.
This looks great! Thank you
This commit adds a validation to check if multiple gist urls/ids are passed during deletion. It accepts only one url/id. Ref. #3015