mirror of https://github.com/docker/compose.git
cmd: consistent handling no-args commands (#9660)
Enforce args rejection for commands without args: * ls * version Additionally, docs for `restart` are fixed. Signed-off-by: piroux <pierre.roux01@gmail.com>
This commit is contained in:
parent
def189fae1
commit
38a18790ed
|
@ -46,6 +46,7 @@ func listCommand(backend api.Service) *cobra.Command {
|
|||
RunE: Adapt(func(ctx context.Context, args []string) error {
|
||||
return runList(ctx, backend, lsOpts)
|
||||
}),
|
||||
Args: cobra.NoArgs,
|
||||
ValidArgsFunction: noCompletion(),
|
||||
}
|
||||
lsCmd.Flags().StringVar(&lsOpts.Format, "format", "pretty", "Format the output. Values: [pretty | json].")
|
||||
|
|
|
@ -35,8 +35,8 @@ func restartCommand(p *projectOptions, backend api.Service) *cobra.Command {
|
|||
projectOptions: p,
|
||||
}
|
||||
restartCmd := &cobra.Command{
|
||||
Use: "restart",
|
||||
Short: "Restart containers",
|
||||
Use: "restart [SERVICE...]",
|
||||
Short: "Restart service containers",
|
||||
RunE: Adapt(func(ctx context.Context, args []string) error {
|
||||
return runRestart(ctx, backend, opts, args)
|
||||
}),
|
||||
|
|
|
@ -37,7 +37,7 @@ func versionCommand() *cobra.Command {
|
|||
cmd := &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Show the Docker Compose version information",
|
||||
Args: cobra.MaximumNArgs(0),
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, _ []string) error {
|
||||
runVersion(opts)
|
||||
return nil
|
||||
|
|
|
@ -23,7 +23,7 @@ Docker Compose
|
|||
| [`ps`](compose_ps.md) | List containers |
|
||||
| [`pull`](compose_pull.md) | Pull service images |
|
||||
| [`push`](compose_push.md) | Push service images |
|
||||
| [`restart`](compose_restart.md) | Restart containers |
|
||||
| [`restart`](compose_restart.md) | Restart service containers |
|
||||
| [`rm`](compose_rm.md) | Removes stopped service containers |
|
||||
| [`run`](compose_run.md) | Run a one-off command on a service. |
|
||||
| [`start`](compose_start.md) | Start services |
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# docker compose restart
|
||||
|
||||
<!---MARKER_GEN_START-->
|
||||
Restart containers
|
||||
Restart service containers
|
||||
|
||||
### Options
|
||||
|
||||
|
@ -14,7 +14,7 @@ Restart containers
|
|||
|
||||
## Description
|
||||
|
||||
Restarts all stopped and running services.
|
||||
Restarts all stopped and running services, or the specified services only.
|
||||
|
||||
If you make changes to your `compose.yml` configuration, these changes are not reflected
|
||||
after running this command. For example, changes to environment variables (which are added
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
command: docker compose restart
|
||||
short: Restart containers
|
||||
short: Restart service containers
|
||||
long: |-
|
||||
Restarts all stopped and running services.
|
||||
Restarts all stopped and running services, or the specified services only.
|
||||
|
||||
If you make changes to your `compose.yml` configuration, these changes are not reflected
|
||||
after running this command. For example, changes to environment variables (which are added
|
||||
|
@ -11,7 +11,7 @@ long: |-
|
|||
If you are looking to configure a service's restart policy, please refer to
|
||||
[restart](https://github.com/compose-spec/compose-spec/blob/master/spec.md#restart)
|
||||
or [restart_policy](https://github.com/compose-spec/compose-spec/blob/master/deploy.md#restart_policy).
|
||||
usage: docker compose restart
|
||||
usage: docker compose restart [SERVICE...]
|
||||
pname: docker compose
|
||||
plink: docker_compose.yaml
|
||||
options:
|
||||
|
|
Loading…
Reference in New Issue