summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorPaul Holzinger <paul.holzinger@web.de>2020-09-08 16:50:23 +0200
committerPaul Holzinger <paul.holzinger@web.de>2020-09-08 21:05:11 +0200
commitea71f613e6cf0a346535372e6e68fbcc9a364b66 (patch)
tree662f97071bc64876c511c3b81d685d4bd3ebf959 /cmd
parentbcb58eacfc678197a5db0ade87eab69804c731f7 (diff)
downloadpodman-ea71f613e6cf0a346535372e6e68fbcc9a364b66.tar.gz
podman-ea71f613e6cf0a346535372e6e68fbcc9a364b66.tar.bz2
podman-ea71f613e6cf0a346535372e6e68fbcc9a364b66.zip
Don't setup the Image/ContainerEngine when calling a cmd with subcmds
There is no need to setup the image and container engine when calling a command with subcommands since we only print a usage message. e.g `podman`,`podman container` This also allows the remote client to show the usage message on these commands without a running endpoint. I added a test for this. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/root.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/cmd/podman/root.go b/cmd/podman/root.go
index 749a5fbe7..6cf369f0a 100644
--- a/cmd/podman/root.go
+++ b/cmd/podman/root.go
@@ -104,8 +104,8 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error {
// TODO: Remove trace statement in podman V2.1
logrus.Debugf("Called %s.PersistentPreRunE(%s)", cmd.Name(), strings.Join(os.Args, " "))
- // Help is a special case, no need for more setup
- if cmd.Name() == "help" {
+ // Help and commands with subcommands are special cases, no need for more setup
+ if cmd.Name() == "help" || cmd.HasSubCommands() {
return nil
}
@@ -204,8 +204,8 @@ func persistentPostRunE(cmd *cobra.Command, args []string) error {
// TODO: Remove trace statement in podman V2.1
logrus.Debugf("Called %s.PersistentPostRunE(%s)", cmd.Name(), strings.Join(os.Args, " "))
- // Help is a special case, no need for more cleanup
- if cmd.Name() == "help" {
+ // Help and commands with subcommands are special cases, no need for more cleanup
+ if cmd.Name() == "help" || cmd.HasSubCommands() {
return nil
}