align "conflicting options" errors for consistency#5488
align "conflicting options" errors for consistency#5488thaJeztah merged 1 commit intodocker:masterfrom
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 <github@gone.nl>
| 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.
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.
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.
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)