mirror of https://github.com/docker/compose.git
feat(run): Add --quiet and --quiet-build options for the run command
Signed-off-by: Suleiman Dibirov <idsulik@gmail.com>
This commit is contained in:
parent
2e75185a07
commit
b543380708
|
@ -67,6 +67,7 @@ type runOptions struct {
|
||||||
noDeps bool
|
noDeps bool
|
||||||
ignoreOrphans bool
|
ignoreOrphans bool
|
||||||
removeOrphans bool
|
removeOrphans bool
|
||||||
|
quiet bool
|
||||||
quietPull bool
|
quietPull bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,6 +181,14 @@ func runCommand(p *ProjectOptions, dockerCli command.Cli, backend api.Service) *
|
||||||
options.noTty = !options.tty
|
options.noTty = !options.tty
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if options.quiet {
|
||||||
|
progress.Mode = progress.ModeQuiet
|
||||||
|
devnull, err := os.Open(os.DevNull)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
os.Stdout = devnull
|
||||||
|
}
|
||||||
createOpts.pullChanged = cmd.Flags().Changed("pull")
|
createOpts.pullChanged = cmd.Flags().Changed("pull")
|
||||||
return nil
|
return nil
|
||||||
}),
|
}),
|
||||||
|
@ -222,6 +231,8 @@ func runCommand(p *ProjectOptions, dockerCli command.Cli, backend api.Service) *
|
||||||
flags.BoolVar(&options.useAliases, "use-aliases", false, "Use the service's network useAliases in the network(s) the container connects to")
|
flags.BoolVar(&options.useAliases, "use-aliases", false, "Use the service's network useAliases in the network(s) the container connects to")
|
||||||
flags.BoolVarP(&options.servicePorts, "service-ports", "P", false, "Run command with all service's ports enabled and mapped to the host")
|
flags.BoolVarP(&options.servicePorts, "service-ports", "P", false, "Run command with all service's ports enabled and mapped to the host")
|
||||||
flags.StringVar(&createOpts.Pull, "pull", "policy", `Pull image before running ("always"|"missing"|"never")`)
|
flags.StringVar(&createOpts.Pull, "pull", "policy", `Pull image before running ("always"|"missing"|"never")`)
|
||||||
|
flags.BoolVarP(&options.quiet, "quiet", "q", false, "Don't print anything to STDOUT")
|
||||||
|
flags.BoolVar(&buildOpts.quiet, "quiet-build", false, "Suppress progress output from the build process")
|
||||||
flags.BoolVar(&options.quietPull, "quiet-pull", false, "Pull without printing progress information")
|
flags.BoolVar(&options.quietPull, "quiet-pull", false, "Pull without printing progress information")
|
||||||
flags.BoolVar(&createOpts.Build, "build", false, "Build image before starting container")
|
flags.BoolVar(&createOpts.Build, "build", false, "Build image before starting container")
|
||||||
flags.BoolVar(&options.removeOrphans, "remove-orphans", false, "Remove containers for services not defined in the Compose file")
|
flags.BoolVar(&options.removeOrphans, "remove-orphans", false, "Remove containers for services not defined in the Compose file")
|
||||||
|
|
|
@ -74,6 +74,8 @@ specified in the service configuration.
|
||||||
| `--no-deps` | `bool` | | Don't start linked services |
|
| `--no-deps` | `bool` | | Don't start linked services |
|
||||||
| `-p`, `--publish` | `stringArray` | | Publish a container's port(s) to the host |
|
| `-p`, `--publish` | `stringArray` | | Publish a container's port(s) to the host |
|
||||||
| `--pull` | `string` | `policy` | Pull image before running ("always"\|"missing"\|"never") |
|
| `--pull` | `string` | `policy` | Pull image before running ("always"\|"missing"\|"never") |
|
||||||
|
| `-q`, `--quiet` | `bool` | | Don't print anything to STDOUT |
|
||||||
|
| `--quiet-build` | `bool` | | Suppress progress output from the build process |
|
||||||
| `--quiet-pull` | `bool` | | Pull without printing progress information |
|
| `--quiet-pull` | `bool` | | Pull without printing progress information |
|
||||||
| `--remove-orphans` | `bool` | | Remove containers for services not defined in the Compose file |
|
| `--remove-orphans` | `bool` | | Remove containers for services not defined in the Compose file |
|
||||||
| `--rm` | `bool` | | Automatically remove the container when it exits |
|
| `--rm` | `bool` | | Automatically remove the container when it exits |
|
||||||
|
|
|
@ -200,6 +200,27 @@ options:
|
||||||
experimentalcli: false
|
experimentalcli: false
|
||||||
kubernetes: false
|
kubernetes: false
|
||||||
swarm: false
|
swarm: false
|
||||||
|
- option: quiet
|
||||||
|
shorthand: q
|
||||||
|
value_type: bool
|
||||||
|
default_value: "false"
|
||||||
|
description: Don't print anything to STDOUT
|
||||||
|
deprecated: false
|
||||||
|
hidden: false
|
||||||
|
experimental: false
|
||||||
|
experimentalcli: false
|
||||||
|
kubernetes: false
|
||||||
|
swarm: false
|
||||||
|
- option: quiet-build
|
||||||
|
value_type: bool
|
||||||
|
default_value: "false"
|
||||||
|
description: Suppress progress output from the build process
|
||||||
|
deprecated: false
|
||||||
|
hidden: false
|
||||||
|
experimental: false
|
||||||
|
experimentalcli: false
|
||||||
|
kubernetes: false
|
||||||
|
swarm: false
|
||||||
- option: quiet-pull
|
- option: quiet-pull
|
||||||
value_type: bool
|
value_type: bool
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
|
|
Loading…
Reference in New Issue