summaryrefslogtreecommitdiff
path: root/cmd/podman/common.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2019-02-11 19:19:19 -0700
committerDaniel J Walsh <dwalsh@redhat.com>2019-02-12 05:14:38 -0700
commitccbc4fb006253788910eba86eb6674d3465992c3 (patch)
treed906767a8c57215b97ccfe979fe4beb201b14f64 /cmd/podman/common.go
parentea20ead35b69b1259f2ff3b00f558c473a921b95 (diff)
downloadpodman-ccbc4fb006253788910eba86eb6674d3465992c3.tar.gz
podman-ccbc4fb006253788910eba86eb6674d3465992c3.tar.bz2
podman-ccbc4fb006253788910eba86eb6674d3465992c3.zip
Don't show global flags except for podman command
Subcommands should not be showing the global flags. This causes the important information to scroll off the screen. Also fixed a typo on runCommmand (Too many 'm's) Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd/podman/common.go')
-rw-r--r--cmd/podman/common.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/cmd/podman/common.go b/cmd/podman/common.go
index 5fbdfce50..417e938b7 100644
--- a/cmd/podman/common.go
+++ b/cmd/podman/common.go
@@ -500,3 +500,27 @@ func scrubServer(server string) string {
server = strings.TrimPrefix(server, "https://")
return strings.TrimPrefix(server, "http://")
}
+
+// UsageTemplate returns the usage template for podman commands
+// This blocks the desplaying of the global options. The main podman
+// command should not use this.
+func UsageTemplate() string {
+ return `Usage:{{if .Runnable}}
+ {{.UseLine}}{{end}}{{if .HasAvailableSubCommands}}
+
+ {{.CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}}
+
+Aliases:
+ {{.NameAndAliases}}{{end}}{{if .HasExample}}
+
+Examples:
+{{.Example}}{{end}}{{if .HasAvailableSubCommands}}
+
+Available Commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name "help"))}}
+ {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableLocalFlags}}
+
+Flags:
+{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasAvailableInheritedFlags}}
+{{end}}
+`
+}