summaryrefslogtreecommitdiff
path: root/cmd/podman/root.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/root.go')
-rw-r--r--cmd/podman/root.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/cmd/podman/root.go b/cmd/podman/root.go
index 84c3867f2..375faf8b1 100644
--- a/cmd/podman/root.go
+++ b/cmd/podman/root.go
@@ -9,6 +9,7 @@ import (
"strings"
"github.com/containers/libpod/cmd/podman/registry"
+ "github.com/containers/libpod/cmd/podman/validate"
"github.com/containers/libpod/pkg/domain/entities"
"github.com/containers/libpod/pkg/rootless"
"github.com/containers/libpod/pkg/tracing"
@@ -34,7 +35,7 @@ Description:
// UsageTemplate is the usage template for podman commands
// This blocks the displaying of the global options. The main podman
// command should not use this.
-const usageTemplate = `Usage(v2):{{if (and .Runnable (not .HasAvailableSubCommands))}}
+const usageTemplate = `Usage:{{if (and .Runnable (not .HasAvailableSubCommands))}}
{{.UseLine}}{{end}}{{if .HasAvailableSubCommands}}
{{.CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}}
@@ -60,7 +61,7 @@ var (
SilenceErrors: true,
TraverseChildren: true,
PersistentPreRunE: persistentPreRunE,
- RunE: registry.SubCommandExists,
+ RunE: validate.SubCommandExists,
PersistentPostRunE: persistentPostRunE,
Version: version.Version,
}
@@ -78,6 +79,10 @@ func init() {
)
rootFlags(registry.PodmanConfig(), rootCmd.PersistentFlags())
+
+ // "version" is a local flag to avoid collisions with sub-commands that use "-v"
+ var dummyVersion bool
+ rootCmd.Flags().BoolVarP(&dummyVersion, "version", "v", false, "Version of Podman")
}
func Execute() {
@@ -96,7 +101,7 @@ func Execute() {
func persistentPreRunE(cmd *cobra.Command, args []string) error {
// TODO: Remove trace statement in podman V2.1
- logrus.Debugf("Called %s.PersistentPreRunE()", cmd.Name())
+ logrus.Debugf("Called %s.PersistentPreRunE(%s)", cmd.Name(), strings.Join(os.Args, " "))
cfg := registry.PodmanConfig()
@@ -145,7 +150,7 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error {
func persistentPostRunE(cmd *cobra.Command, args []string) error {
// TODO: Remove trace statement in podman V2.1
- logrus.Debugf("Called %s.PersistentPostRunE()", cmd.Name())
+ logrus.Debugf("Called %s.PersistentPostRunE(%s)", cmd.Name(), strings.Join(os.Args, " "))
cfg := registry.PodmanConfig()
if cmd.Flag("cpu-profile").Changed {
@@ -206,11 +211,6 @@ func rootFlags(opts *entities.PodmanConfig, flags *pflag.FlagSet) {
flags.StringVarP(&opts.Uri, "remote", "r", "", "URL to access Podman service")
flags.StringSliceVar(&opts.Identities, "identity", []string{}, "path to SSH identity file")
- // Override default --help information of `--version` global flag
- // TODO: restore -v option for version without breaking -v for volumes
- var dummyVersion bool
- flags.BoolVar(&dummyVersion, "version", false, "Version of Podman")
-
cfg := opts.Config
flags.StringVar(&cfg.Engine.CgroupManager, "cgroup-manager", cfg.Engine.CgroupManager, opts.CGroupUsage)
flags.StringVar(&opts.CpuProfile, "cpu-profile", "", "Path for the cpu profiling results")