Skip to content

Commit

Permalink
Better usage synopses for subcommands
Browse files Browse the repository at this point in the history
Conceptually simple: include, where applicable, a brief
description of command-line options for each subcommand.

Signed-off-by: Ed Santiago <[email protected]>
  • Loading branch information
edsantiago committed Feb 27, 2019
1 parent ee667dc commit a20ff42
Show file tree
Hide file tree
Showing 58 changed files with 65 additions and 61 deletions.
2 changes: 1 addition & 1 deletion cmd/podman/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var (
attachCommand cliconfig.AttachValues
attachDescription = "The podman attach command allows you to attach to a running container using the container's ID or name, either to view its ongoing output or to control it interactively."
_attachCommand = &cobra.Command{
Use: "attach",
Use: "attach [flags] CONTAINER",
Short: "Attach to a running container",
Long: attachDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var (
namespaceValues buildahcli.NameSpaceResults

_buildCommand = &cobra.Command{
Use: "build",
Use: "build [flags] CONTEXT",
Short: "Build an image using instructions from Dockerfiles",
Long: buildDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var (
Checkpoints one or more running containers. The container name or ID can be used.
`
_checkpointCommand = &cobra.Command{
Use: "checkpoint",
Use: "checkpoint [flags] CONTAINER [CONTAINER...]",
Short: "Checkpoints one or more containers",
Long: checkpointDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (
Cleans up mount points and network stacks on one or more containers from the host. The container name or ID can be used. This command is used internally when running containers, but can also be used if container cleanup has failed when a container exits.
`
_cleanupCommand = &cobra.Command{
Use: "cleanup",
Use: "cleanup [flags] CONTAINER [CONTAINER...]",
Short: "Cleanup network and mountpoints of one or more containers",
Long: cleanupDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var (
and make changes to the instructions with the --change flag.`

_commitCommand = &cobra.Command{
Use: "commit",
Use: "commit [flags] CONTAINER IMAGE",
Short: "Create new image based on the changed container",
Long: commitDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var (

cpDescription = "Copy files/folders between a container and the local filesystem"
_cpCommand = &cobra.Command{
Use: "cp",
Use: "cp [flags] SRC_PATH DEST_PATH",
Short: "Copy files/folders between a container and the local filesystem",
Long: cpDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var (
" any time with the podman start <container_id> command. The container" +
" will be created with the initial state 'created'."
_createCommand = &cobra.Command{
Use: "create",
Use: "create [flags] IMAGE [COMMAND [ARG...]]",
Short: "Create but do not start a container",
Long: createDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var (
container or image will be compared to its parent layer`)

_diffCommand = &cobra.Command{
Use: "diff",
Use: "diff [flags] CONTAINER | IMAGE",
Short: "Inspect changes on container's file systems",
Long: diffDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var (
Run a command in a running container
`
_execCommand = &cobra.Command{
Use: "exec",
Use: "exec [flags] CONTAINER [COMMAND [ARG...]]",
Short: "Run a process in a running container",
Long: execDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
9 changes: 6 additions & 3 deletions cmd/podman/exists.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var (
Check if a pod exists in local storage
`
_imageExistsCommand = &cobra.Command{
Use: "exists",
Use: "exists IMAGE",
Short: "Check if an image exists in local storage",
Long: imageExistsDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand All @@ -44,7 +44,7 @@ var (
}

_containerExistsCommand = &cobra.Command{
Use: "exists",
Use: "exists CONTAINER",
Short: "Check if a container exists in local storage",
Long: containerExistsDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand All @@ -57,7 +57,7 @@ var (
}

_podExistsCommand = &cobra.Command{
Use: "exists",
Use: "exists POD",
Short: "Check if a pod exists in local storage",
Long: podExistsDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand All @@ -71,10 +71,13 @@ var (

func init() {
imageExistsCommand.Command = _imageExistsCommand
imageExistsCommand.DisableFlagsInUseLine = true
imageExistsCommand.SetUsageTemplate(UsageTemplate())
containerExistsCommand.Command = _containerExistsCommand
containerExistsCommand.DisableFlagsInUseLine = true
containerExistsCommand.SetUsageTemplate(UsageTemplate())
podExistsCommand.Command = _podExistsCommand
podExistsCommand.DisableFlagsInUseLine = true
podExistsCommand.SetUsageTemplate(UsageTemplate())
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var (
" and saves it on the local machine."

_exportCommand = &cobra.Command{
Use: "export",
Use: "export [flags] CONTAINER",
Short: "Export container's filesystem contents as a tar archive",
Long: exportDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/generate_kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var (
containerKubeCommand cliconfig.GenerateKubeValues
containerKubeDescription = "Generate Kubernetes Pod YAML"
_containerKubeCommand = &cobra.Command{
Use: "kube",
Use: "kube CONTAINER | POD",
Short: "Generate Kubernetes pod YAML for a container or pod",
Long: containerKubeDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var (
historyDescription = "Displays the history of an image. The information can be printed out in an easy to read, " +
"or user specified format, and can be truncated."
_historyCommand = &cobra.Command{
Use: "history",
Use: "history [flags] IMAGE",
Short: "Show history of a specified image",
Long: historyDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var (
Optionally tag the image. You can specify the instructions using the --change option.
`
_importCommand = &cobra.Command{
Use: "import",
Use: "import [flags] PATH [REFERENCE]",
Short: "Import a tarball to create a filesystem image",
Long: importDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var (

inspectDescription = "This displays the low-level information on containers and images identified by name or ID. By default, this will render all results in a JSON array. If the container and image have the same name, this will return container JSON for unspecified type."
_inspectCommand = &cobra.Command{
Use: "inspect",
Use: "inspect [flags] CONTAINER | IMAGE",
Short: "Display the configuration of a container or image",
Long: inspectDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/kill.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var (

killDescription = "The main process inside each container specified will be sent SIGKILL, or any signal specified with option --signal."
_killCommand = &cobra.Command{
Use: "kill",
Use: "kill [flags] CONTAINER [CONTAINER...]",
Short: "Kill one or more running containers with a specific signal",
Long: killDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var (

loadDescription = "Loads the image from docker-archive stored on the local machine."
_loadCommand = &cobra.Command{
Use: "load",
Use: "load [flags] [PATH]",
Short: "Load an image from docker archive",
Long: loadDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var (

loginDescription = "Login to a container registry on a specified server."
_loginCommand = &cobra.Command{
Use: "login",
Use: "login [flags] REGISTRY",
Short: "Login to a container registry",
Long: loginDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var (
logoutCommand cliconfig.LogoutValues
logoutDescription = "Remove the cached username and password for the registry."
_logoutCommand = &cobra.Command{
Use: "logout",
Use: "logout [flags] REGISTRY",
Short: "Logout of a container registry",
Long: logoutDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (
logsDescription = "The podman logs command batch-retrieves whatever logs are present for a container at the time of execution. This does not guarantee execution" +
"order when combined with podman run (i.e. your run may not have generated any logs at the time you execute podman logs"
_logsCommand = &cobra.Command{
Use: "logs",
Use: "logs [flags] CONTAINER",
Short: "Fetch the logs of a container",
Long: logsDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var (
`

_mountCommand = &cobra.Command{
Use: "mount",
Use: "mount [flags] CONTAINER",
Short: "Mount a working container's root filesystem",
Long: mountDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
4 changes: 2 additions & 2 deletions cmd/podman/pause.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var (
Pauses one or more running containers. The container name or ID can be used.
`
_pauseCommand = &cobra.Command{
Use: "pause",
Use: "pause [flags] CONTAINER [CONTAINER...]",
Short: "Pause all the processes in one or more containers",
Long: pauseDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand All @@ -30,7 +30,7 @@ var (
},
Example: `podman pause mywebserver
podman pause 860a4b23
podman stop -a`,
podman pause -a`,
}
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/play_kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var (
playKubeCommand cliconfig.KubePlayValues
playKubeDescription = "Play a Pod and its containers based on a Kubrernetes YAML"
_playKubeCommand = &cobra.Command{
Use: "kube",
Use: "kube [flags] KUBEFILE",
Short: "Play a pod based on Kubernetes YAML",
Long: playKubeDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/pod_inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var (
podInspectCommand cliconfig.PodInspectValues
podInspectDescription = "Display the configuration for a pod by name or id"
_podInspectCommand = &cobra.Command{
Use: "inspect",
Use: "inspect [flags] POD",
Short: "Displays a pod configuration",
Long: podInspectDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/pod_kill.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var (
podKillCommand cliconfig.PodKillValues
podKillDescription = "The main process of each container inside the specified pod will be sent SIGKILL, or any signal specified with option --signal."
_podKillCommand = &cobra.Command{
Use: "kill",
Use: "kill [flags] POD [POD...]",
Short: "Send the specified signal or SIGKILL to containers in pod",
Long: podKillDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/pod_pause.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var (
podPauseCommand cliconfig.PodPauseValues
podPauseDescription = `Pauses one or more pods. The pod name or ID can be used.`
_podPauseCommand = &cobra.Command{
Use: "pause",
Use: "pause [flags] POD [POD...]",
Short: "Pause one or more pods",
Long: podPauseDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/pod_restart.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var (
podRestartCommand cliconfig.PodRestartValues
podRestartDescription = `Restarts one or more pods. The pod ID or name can be used.`
_podRestartCommand = &cobra.Command{
Use: "restart",
Use: "restart [flags] POD [POD...]",
Short: "Restart one or more pods",
Long: podRestartDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/pod_rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ be used. A pod with containers will not be removed without --force.
If --force is specified, all containers will be stopped, then removed.
`)
_podRmCommand = &cobra.Command{
Use: "rm",
Use: "rm [flags] POD [POD...]",
Short: "Remove one or more pods",
Long: podRmDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/pod_start.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (
Starts one or more pods. The pod name or ID can be used.
`
_podStartCommand = &cobra.Command{
Use: "start",
Use: "start POD [POD...]",
Short: "Start one or more pods",
Long: podStartDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/pod_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var (
podStatsCommand cliconfig.PodStatsValues
podStatsDescription = "Display a live stream of resource usage statistics for the containers in or more pods"
_podStatsCommand = &cobra.Command{
Use: "stats",
Use: "stats [flags] POD [POD...]",
Short: "Display percentage of CPU, memory, network I/O, block I/O and PIDs for containers in one or more pods",
Long: podStatsDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/pod_stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var (
`

_podStopCommand = &cobra.Command{
Use: "stop",
Use: "stop [flags] POD [POD...]",
Short: "Stop one or more pods",
Long: podStopDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/pod_top.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ the latest pod.
`, getDescriptorString())

_podTopCommand = &cobra.Command{
Use: "top",
Use: "top [flags] CONTAINER [FORMAT-DESCRIPTORS]",
Short: "Display the running processes of containers in a pod",
Long: podTopDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/pod_unpause.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var (
podUnpauseCommand cliconfig.PodUnpauseValues
podUnpauseDescription = `Unpauses one or more pods. The pod name or ID can be used.`
_podUnpauseCommand = &cobra.Command{
Use: "unpause",
Use: "unpause [flags] POD [POD...]",
Short: "Unpause one or more pods",
Long: podUnpauseDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/port.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var (
List port mappings for the CONTAINER, or lookup the public-facing port that is NAT-ed to the PRIVATE_PORT
`
_portCommand = &cobra.Command{
Use: "port",
Use: "port [flags] CONTAINER",
Short: "List port mappings or a specific mapping for the container",
Long: portDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ An image can be pulled using its tag or digest. If a tag is not
specified, the image with the 'latest' tag (if it exists) is pulled
`
_pullCommand = &cobra.Command{
Use: "pull",
Use: "pull [flags] IMAGE-PATH",
Short: "Pull an image from a registry",
Long: pullDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var (
See podman-push(1) section "DESTINATION" for the expected format`)

_pushCommand = &cobra.Command{
Use: "push",
Use: "push [flags] IMAGE REGISTRY",
Short: "Push an image to a specified destination",
Long: pushDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/restart.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (
restartCommand cliconfig.RestartValues
restartDescription = `Restarts one or more running containers. The container ID or name can be used. A timeout before forcibly stopping can be set, but defaults to 10 seconds`
_restartCommand = &cobra.Command{
Use: "restart",
Use: "restart [flags] CONTAINER [CONTAINER...]",
Short: "Restart one or more containers",
Long: restartDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var (
Restores a container from a checkpoint. The container name or ID can be used.
`
_restoreCommand = &cobra.Command{
Use: "restore",
Use: "restore [flags] CONTAINER [CONTAINER...]",
Short: "Restores one or more containers from a checkpoint",
Long: restoreDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The container name or ID can be used. This does not remove images.
Running containers will not be removed without the -f option.
`)
_rmCommand = &cobra.Command{
Use: "rm",
Use: "rm [flags] CONTAINER [CONTAINER...]",
Short: "Remove one or more containers",
Long: rmDescription,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
Loading

0 comments on commit a20ff42

Please sign in to comment.