-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Enforce consistent args rejection for no-args commands: ls, restart, version #9660
Conversation
83394b7
to
f3af3e6
Compare
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.
LGTM
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 let you choose what you want to do:
- Update the restart documentation in your PR
- Remove your changes for the
restart
command
cmd/compose/restart.go
Outdated
@@ -40,6 +40,7 @@ func restartCommand(p *projectOptions, backend api.Service) *cobra.Command { | |||
RunE: Adapt(func(ctx context.Context, args []string) error { | |||
return runRestart(ctx, backend, opts, args) | |||
}), | |||
Args: cobra.NoArgs, |
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.
Ok I think we should update the documentation of the restart
command to show the optional service name arg!
Restart allows you to choose a specific service to restart so you can pass an argument like that:
docker compose restart my-service
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.
We shouldn't change this, right? It implies losing the ability to just restart a specific service, which people might be relying on. I'd prefer to keep the current compose restart
behaviour unless there is a reason for changing it.
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.
We'll keep the actual behavior for sure, that's why I proposed to update the doc or remove the modification for the restart
command
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.
Sorry, I had overlooked that restart
could be used like that too.
So yes, let's update the docs.
b2ddd9c
to
a920ffb
Compare
You need to resolve your conflict in order to start the CI process |
a920ffb
to
72c8727
Compare
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.
Doing modification in the documentation isn't trivial 😅
You should modify the command itself in the restart.go
file and then use make docs
to generate the yaml and md doc files.
737abf9
to
341e7d0
Compare
Signed-off-by: piroux <[email protected]>
Signed-off-by: piroux <[email protected]>
Signed-off-by: piroux <[email protected]>
Signed-off-by: piroux <[email protected]>
341e7d0
to
db0295a
Compare
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.
LGTM
What I did
Make cobra to reject arguments for no-args commands in the same manner:
ls
version
down
was done already)For the
restart
command, the documentation is updated to let the user know that services can be passed as arguments.Related issue
Based on #9158 which enforced it for the
down
command.According to the listing below, these 4 commands were the only ones to not handle arguments.