Skip to content

Commit

Permalink
Docs: consistency between man / --help
Browse files Browse the repository at this point in the history
New functionality in hack/man-page-checker: start cross-
referencing the man page 'Synopsis' line against the
output of 'podman foo --help'. This is part 1, flag/option
consistency. Part 2 (arg consistency) is too big and will
have to wait for later.

flag/option consistency means: if 'podman foo --help'
includes the string '[flags]' in the Usage message,
make sure the man page includes '[*options*]' in its
Synopsis line, and vice-versa. This found several
inconsistencies, which I've fixed.

While doing this I realized that Cobra automatically
includes a 'Flags:' subsection in its --help output
for all subcommands that have defined flags. This
is great - it lets us cross-check against the
usage synopsis, and make sure that '[flags]' is
present or absent as needed, without fear of
human screwups. If a flag-less subcommand ever
gets extended with flags, but the developer forgets
to add '[flags]' and remove DisableFlagsInUseLine,
we now have a test that will catch that. (This,
too, caught two instances which I fixed).

I don't actually know if the new man-page-checker
functionality will work in CI: I vaguely recall that
it might run before 'make podman' does; and also
vaguely recall that some steps were taken to remedy
that.

Signed-off-by: Ed Santiago <santiago@redhat.com>
  • Loading branch information
edsantiago committed Jun 24, 2020
1 parent 988fd27 commit c6090c2
Show file tree
Hide file tree
Showing 26 changed files with 162 additions and 77 deletions.
13 changes: 7 additions & 6 deletions cmd/podman/healthcheck/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ import (
var (
healthcheckRunDescription = "run the health check of a container"
healthcheckrunCommand = &cobra.Command{
Use: "run [flags] CONTAINER",
Short: "run the health check of a container",
Long: healthcheckRunDescription,
Example: `podman healthcheck run mywebapp`,
RunE: run,
Args: cobra.ExactArgs(1),
Use: "run CONTAINER",
Short: "run the health check of a container",
Long: healthcheckRunDescription,
Example: `podman healthcheck run mywebapp`,
RunE: run,
Args: cobra.ExactArgs(1),
DisableFlagsInUseLine: true,
}
)

Expand Down
22 changes: 12 additions & 10 deletions cmd/podman/images/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,24 @@ import (
var (
tagDescription = "Adds one or more additional names to locally-stored image."
tagCommand = &cobra.Command{
Use: "tag [flags] IMAGE TARGET_NAME [TARGET_NAME...]",
Short: "Add an additional name to a local image",
Long: tagDescription,
RunE: tag,
Args: cobra.MinimumNArgs(2),
Use: "tag IMAGE TARGET_NAME [TARGET_NAME...]",
Short: "Add an additional name to a local image",
Long: tagDescription,
RunE: tag,
Args: cobra.MinimumNArgs(2),
DisableFlagsInUseLine: true,
Example: `podman tag 0e3bbc2 fedora:latest
podman tag imageID:latest myNewImage:newTag
podman tag httpd myregistryhost:5000/fedora/httpd:v2`,
}

imageTagCommand = &cobra.Command{
Args: tagCommand.Args,
Use: tagCommand.Use,
Short: tagCommand.Short,
Long: tagCommand.Long,
RunE: tagCommand.RunE,
Args: tagCommand.Args,
DisableFlagsInUseLine: true,
Use: tagCommand.Use,
Short: tagCommand.Short,
Long: tagCommand.Long,
RunE: tagCommand.RunE,
Example: `podman image tag 0e3bbc2 fedora:latest
podman image tag imageID:latest myNewImage:newTag
podman image tag httpd myregistryhost:5000/fedora/httpd:v2`,
Expand Down
22 changes: 12 additions & 10 deletions cmd/podman/images/untag.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,24 @@ import (

var (
untagCommand = &cobra.Command{
Use: "untag [flags] IMAGE [NAME...]",
Short: "Remove a name from a local image",
Long: "Removes one or more names from a locally-stored image.",
RunE: untag,
Args: cobra.MinimumNArgs(1),
Use: "untag IMAGE [NAME...]",
Short: "Remove a name from a local image",
Long: "Removes one or more names from a locally-stored image.",
RunE: untag,
Args: cobra.MinimumNArgs(1),
DisableFlagsInUseLine: true,
Example: `podman untag 0e3bbc2
podman untag imageID:latest otherImageName:latest
podman untag httpd myregistryhost:5000/fedora/httpd:v2`,
}

imageUntagCommand = &cobra.Command{
Args: untagCommand.Args,
Use: untagCommand.Use,
Short: untagCommand.Short,
Long: untagCommand.Long,
RunE: untagCommand.RunE,
Args: untagCommand.Args,
DisableFlagsInUseLine: true,
Use: untagCommand.Use,
Short: untagCommand.Short,
Long: untagCommand.Long,
RunE: untagCommand.RunE,
Example: `podman image untag 0e3bbc2
podman image untag imageID:latest otherImageName:latest
podman image untag httpd myregistryhost:5000/fedora/httpd:v2`,
Expand Down
13 changes: 7 additions & 6 deletions cmd/podman/manifest/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ import (

var (
inspectCmd = &cobra.Command{
Use: "inspect [flags] IMAGE",
Short: "Display the contents of a manifest list or image index",
Long: "Display the contents of a manifest list or image index.",
RunE: inspect,
Example: "podman manifest inspect localhost/list",
Args: cobra.ExactArgs(1),
Use: "inspect IMAGE",
Short: "Display the contents of a manifest list or image index",
Long: "Display the contents of a manifest list or image index.",
RunE: inspect,
Example: "podman manifest inspect localhost/list",
Args: cobra.ExactArgs(1),
DisableFlagsInUseLine: true,
}
)

Expand Down
13 changes: 7 additions & 6 deletions cmd/podman/manifest/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ import (

var (
removeCmd = &cobra.Command{
Use: "remove [flags] LIST IMAGE",
Short: "Remove an entry from a manifest list or image index",
Long: "Removes an image from a manifest list or image index.",
RunE: remove,
Example: `podman manifest remove mylist:v1.11 sha256:15352d97781ffdf357bf3459c037be3efac4133dc9070c2dce7eca7c05c3e736`,
Args: cobra.ExactArgs(2),
Use: "remove LIST IMAGE",
Short: "Remove an entry from a manifest list or image index",
Long: "Removes an image from a manifest list or image index.",
RunE: remove,
Example: `podman manifest remove mylist:v1.11 sha256:15352d97781ffdf357bf3459c037be3efac4133dc9070c2dce7eca7c05c3e736`,
Args: cobra.ExactArgs(2),
DisableFlagsInUseLine: true,
}
)

Expand Down
11 changes: 6 additions & 5 deletions cmd/podman/system/renumber.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ var (
`

renumberCommand = &cobra.Command{
Use: "renumber",
Args: validate.NoArgs,
Short: "Migrate lock numbers",
Long: renumberDescription,
Run: renumber,
Use: "renumber",
Args: validate.NoArgs,
DisableFlagsInUseLine: true,
Short: "Migrate lock numbers",
Long: renumberDescription,
Run: renumber,
}
)

Expand Down
9 changes: 5 additions & 4 deletions cmd/podman/system/unshare.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import (
var (
unshareDescription = "Runs a command in a modified user namespace."
unshareCommand = &cobra.Command{
Use: "unshare [flags] [COMMAND [ARG ...]]",
Short: "Run a command in a modified user namespace",
Long: unshareDescription,
RunE: unshare,
Use: "unshare [COMMAND [ARG ...]]",
DisableFlagsInUseLine: true,
Short: "Run a command in a modified user namespace",
Long: unshareDescription,
RunE: unshare,
Example: `podman unshare id
podman unshare cat /proc/self/uid_map,
podman unshare podman-script.sh`,
Expand Down
2 changes: 1 addition & 1 deletion docs/source/markdown/podman-auto-update.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
podman-auto-update - Auto update containers according to their auto-update policy

## SYNOPSIS
**podman auto-update**
**podman auto-update** [*options*]

## DESCRIPTION
`podman auto-update` looks up containers with a specified "io.containers.autoupdate" label (i.e., the auto-update policy).
Expand Down
2 changes: 1 addition & 1 deletion docs/source/markdown/podman-container-exists.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
podman-container-exists - Check if a container exists in local storage

## SYNOPSIS
**podman container exists** [*options*] *container*
**podman container exists** *container*

## DESCRIPTION
**podman container exists** checks if a container exists in local storage. The **ID** or **Name**
Expand Down
2 changes: 1 addition & 1 deletion docs/source/markdown/podman-healthcheck-run.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
podman\-healthcheck\-run - Run a container healthcheck

## SYNOPSIS
**podman healthcheck run** [*options*] *container*
**podman healthcheck run** *container*

## DESCRIPTION

Expand Down
2 changes: 1 addition & 1 deletion docs/source/markdown/podman-image-exists.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
podman-image-exists - Check if an image exists in local storage

## SYNOPSIS
**podman image exists** [*options*] *image*
**podman image exists** *image*

## DESCRIPTION
**podman image exists** checks if an image exists in local storage. The **ID** or **Name**
Expand Down
2 changes: 1 addition & 1 deletion docs/source/markdown/podman-manifest-add.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
podman\-manifest\-add - Add an image to a manifest list or image index

## SYNOPSIS
**podman manifest add** *listnameorindexname* *imagename*
**podman manifest add** [*options*] *listnameorindexname* *imagename*

## DESCRIPTION

Expand Down
2 changes: 1 addition & 1 deletion docs/source/markdown/podman-manifest-annotate.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
podman\-manifest\-annotate - Add or update information about an entry in a manifest list or image index

## SYNOPSIS
**podman manifest annotate** [options...] *listnameorindexname* *imagemanifestdigest*
**podman manifest annotate** [*options*] *listnameorindexname* *imagemanifestdigest*

## DESCRIPTION

Expand Down
2 changes: 1 addition & 1 deletion docs/source/markdown/podman-manifest-push.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
podman\-manifest\-push - Push a manifest list or image index to a registry

## SYNOPSIS
**podman manifest push** [options...] *listnameorindexname* *transport:details*
**podman manifest push** [*options*] *listnameorindexname* *transport:details*

## DESCRIPTION
Pushes a manifest list or image index to a registry.
Expand Down
4 changes: 2 additions & 2 deletions docs/source/markdown/podman-mount.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
podman\-mount - Mount a working container's root filesystem

## SYNOPSIS
**podman mount** [*container* ...]
**podman mount** [*options*] [*container* ...]

**podman container mount** [*container* ...]
**podman container mount** [*options*] [*container* ...]

## DESCRIPTION
Mounts the specified containers' root file system in a location which can be
Expand Down
2 changes: 1 addition & 1 deletion docs/source/markdown/podman-network-inspect.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
podman\-network\-inspect - Displays the raw CNI network configuration for one or more networks

## SYNOPSIS
**podman network inspect** [*network* ...]
**podman network inspect** [*options*] [*network* ...]

## DESCRIPTION
Display the raw (JSON format) network configuration. This command is not available for rootless users.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/markdown/podman-network-rm.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
podman\-network\-rm - Remove one or more CNI networks

## SYNOPSIS
**podman network rm** [*network...*]
**podman network rm** [*options*] [*network...*]

## DESCRIPTION
Delete one or more Podman networks.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/markdown/podman-pod-prune.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
podman-pod-prune - Remove all stopped pods and their containers

## SYNOPSIS
**podman pod prune**
**podman pod prune** [*options*]

## DESCRIPTION
**podman pod prune** removes all stopped pods and their containers from local storage.
Expand Down
4 changes: 2 additions & 2 deletions docs/source/markdown/podman-rmi.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
podman\-rmi - Removes one or more locally stored images

## SYNOPSIS
**podman rmi** *image* [...]
**podman rmi** [*options*] *image* [...]

**podman image rm** *image* [...]
**podman image rm** [*options*] *image* [...]

## DESCRIPTION
Removes one or more locally stored images.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/markdown/podman-system-migrate.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
podman\-system\-migrate - Migrate existing containers to a new podman version

## SYNOPSIS
**podman system migrate**
**podman system migrate** [*options*]

## DESCRIPTION
**podman system migrate** migrates containers to the latest podman version.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/markdown/podman-system-reset.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
podman\-system\-reset - Reset storage back to initial state

## SYNOPSIS
**podman system reset**
**podman system reset** [*options*]

## DESCRIPTION
**podman system reset** removes all pods, containers, images and volumes.
Expand Down
8 changes: 4 additions & 4 deletions docs/source/markdown/podman-umount.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
podman\-umount - Unmount a working container's root filesystem

## SYNOPSIS
**podman umount** *container* [...]
**podman umount** [*options*] *container* [...]

**podman container umount** *container* [...]
**podman container umount** [*options*] *container* [...]

**podman container unmount** *container* [...]
**podman container unmount** [*options*] *container* [...]

**podman unmount** *container* [...]
**podman unmount** [*options*] *container* [...]

## DESCRIPTION
Unmounts the specified containers' root file system, if no other processes
Expand Down
2 changes: 1 addition & 1 deletion docs/source/markdown/podman-unshare.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
podman\-unshare - Run a command inside of a modified user namespace

## SYNOPSIS
**podman unshare** [*options*] [*--*] [*command*]
**podman unshare** [*--*] [*command*]

## DESCRIPTION
Launches a process (by default, *$SHELL*) in a new user namespace. The user
Expand Down
4 changes: 2 additions & 2 deletions docs/source/markdown/podman-untag.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
podman\-untag - Removes one or more names from a locally-stored image

## SYNOPSIS
**podman untag** [*options*] *image* [*name*[:*tag*]...]
**podman untag** *image* [*name*[:*tag*]...]

**podman image untag** [*options*] *image* [*name*[:*tag*]...]
**podman image untag** *image* [*name*[:*tag*]...]

## DESCRIPTION
Remove one or more names from an image in the local storage. The image can be referred to by ID or reference. If a no name is specified, all names are removed the image. If a specified name is a short name and does not include a registry `localhost/` will be prefixed (e.g., `fedora` -> `localhost/fedora`). If a specified name does not include a tag `:latest` will be appended (e.g., `localhost/fedora` -> `localhost/fedora:latest`).
Expand Down
Loading

0 comments on commit c6090c2

Please sign in to comment.