-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
align "conflicting options" errors for consistency #5488
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5488 +/- ##
=======================================
Coverage 60.04% 60.05%
=======================================
Files 345 345
Lines 23440 23440
=======================================
+ Hits 14074 14076 +2
+ Misses 8391 8390 -1
+ Partials 975 974 -1 |
Oh! Looks like I broke something; I was testing some things, so perhaps I forgot to restore some code;
|
LOL, yeah, that test isn't great as it reports "but got none" which... is a LIE! cli/cli/command/container/opts_test.go Lines 819 to 825 in 3907414
|
Signed-off-by: Sebastiaan van Stijn <[email protected]>
@@ -52,7 +52,7 @@ func newCreateCommand(dockerCli command.Cli) *cobra.Command { | |||
RunE: func(cmd *cobra.Command, args []string) error { | |||
if len(args) == 1 { | |||
if options.name != "" { | |||
return errors.Errorf("conflicting options: either specify --name or provide positional arg, not both") | |||
return errors.Errorf("conflicting options: cannot specify a volume-name through both --name and as a positional arg") |
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.
is there a specific (i'd guess historical) reason this command has support for both an option and a positional arg for the name?
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.
Yeah, there was some back-and-forth whether name should be a positional arg or a flag. The --name
was changed to a positional arg, but because it already shipped was kept (but soft-deprecated / hidden).
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.
I think I may have been partially responsible for that, considering that docker volume create foobar
is more convenient than docker volume create --name=foobar
, but later discussions were that, because name is optional, using a --flag
is a more common convention.
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)