summaryrefslogtreecommitdiff
path: root/cmd/podman/start.go
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2019-03-13 13:49:39 -0600
committerEd Santiago <santiago@redhat.com>2019-03-13 16:34:31 -0600
commit8f82edbcb3f43e39e037327ad39f4e660e11f20e (patch)
tree727378218d3726972ed232d3c5ffed03eb543cf5 /cmd/podman/start.go
parent7426d4fbbeaf5ebd3d55576add89b99cd3f3f760 (diff)
downloadpodman-8f82edbcb3f43e39e037327ad39f4e660e11f20e.tar.gz
podman-8f82edbcb3f43e39e037327ad39f4e660e11f20e.tar.bz2
podman-8f82edbcb3f43e39e037327ad39f4e660e11f20e.zip
Usage messages: deduplicate '(default true)' et al
Remove hardcoded '(default: true)' strings from bool flags, and '(default this-or-that)' from string flags. First because it's unmaintainable duplication that would cause confusion should someone ever change the default and not notice the message. Second, because cobra[1] already prints '(default XXXX)' for all options with non-false non-nil default. So in each of these cases, current podman help behavior is: $ podman login --help ... --tls-verify Require HTTPS ... (default: true) (default true) This PR eliminates that duplication. [1] actually spf13/pflag/flag.go The only nontrivial one of these is start.go, where the default for sigProxy depends on the --attach flag. Solution: change the command-line default to false, and implement the new conditional default in logic. Bonus: removed unnecessary check, because now if sigProxy is set without --attach, we can guarantee that it was done by the user. But please pay close scrutiny to this particular section in case there's something I missed. Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'cmd/podman/start.go')
-rw-r--r--cmd/podman/start.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/cmd/podman/start.go b/cmd/podman/start.go
index e942c1ccd..cf406cf66 100644
--- a/cmd/podman/start.go
+++ b/cmd/podman/start.go
@@ -41,7 +41,7 @@ func init() {
flags.StringVar(&startCommand.DetachKeys, "detach-keys", "", "Override the key sequence for detaching a container. Format is a single character [a-Z] or ctrl-<value> where <value> is one of: a-z, @, ^, [, , or _")
flags.BoolVarP(&startCommand.Interactive, "interactive", "i", false, "Keep STDIN open even if not attached")
flags.BoolVarP(&startCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of")
- flags.BoolVar(&startCommand.SigProxy, "sig-proxy", true, "Proxy received signals to the process (default true if attaching, false otherwise)")
+ flags.BoolVar(&startCommand.SigProxy, "sig-proxy", false, "Proxy received signals to the process (default true if attaching, false otherwise)")
markFlagHiddenForRemoteClient("latest", flags)
}
@@ -62,14 +62,10 @@ func startCmd(c *cliconfig.StartValues) error {
return errors.Errorf("you cannot start and attach multiple containers at once")
}
- sigProxy := c.SigProxy
+ sigProxy := c.SigProxy || attach
if sigProxy && !attach {
- if c.Flag("sig-proxy").Changed {
- return errors.Wrapf(libpod.ErrInvalidArg, "you cannot use sig-proxy without --attach")
- } else {
- sigProxy = false
- }
+ return errors.Wrapf(libpod.ErrInvalidArg, "you cannot use sig-proxy without --attach")
}
runtime, err := libpodruntime.GetRuntime(&c.PodmanCommand)