Skip to content

Commit

Permalink
Merge pull request containers#16878 from rhatdan/docs
Browse files Browse the repository at this point in the history
Unify --noheading and -n to be consistent on all commands
  • Loading branch information
openshift-merge-robot authored Dec 19, 2022
2 parents b0acb59 + 9187df5 commit fb967aa
Show file tree
Hide file tree
Showing 18 changed files with 45 additions and 29 deletions.
2 changes: 1 addition & 1 deletion cmd/podman/machine/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func init() {
formatFlagName := "format"
flags.StringVar(&listFlag.format, formatFlagName, "{{range .}}{{.Name}}\t{{.VMType}}\t{{.Created}}\t{{.LastUp}}\t{{.CPUs}}\t{{.Memory}}\t{{.DiskSize}}\n{{end -}}", "Format volume output using JSON or a Go template")
_ = lsCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&entities.ListReporter{}))
flags.BoolVar(&listFlag.noHeading, "noheading", false, "Do not print headers")
flags.BoolVarP(&listFlag.noHeading, "noheading", "n", false, "Do not print headers")
flags.BoolVarP(&listFlag.quiet, "quiet", "q", false, "Show only machine names")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/networks/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func networkListFlags(flags *pflag.FlagSet) {

filterFlagName := "filter"
flags.StringArrayVarP(&filters, filterFlagName, "f", nil, "Provide filter values (e.g. 'name=podman')")
flags.Bool("noheading", false, "Do not print headers")
flags.BoolP("noheading", "n", false, "Do not print headers")
_ = networklistCommand.RegisterFlagCompletionFunc(filterFlagName, common.AutocompleteNetworkFilters)
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/pods/ps.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func init() {
flags.StringVar(&psInput.Format, formatFlagName, "", "Pretty-print pods to JSON or using a Go template")
_ = psCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&ListPodReporter{}))

flags.Bool("noheading", false, "Do not print headers")
flags.BoolP("noheading", "n", false, "Do not print headers")
flags.BoolVar(&psInput.Namespace, "ns", false, "Display namespace information of the pod")
flags.BoolVar(&noTrunc, "no-trunc", false, "Do not truncate pod and container IDs")
flags.BoolVarP(&psInput.Quiet, "quiet", "q", false, "Print the numeric IDs of the pods only")
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/secrets/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func init() {
_ = lsCmd.RegisterFlagCompletionFunc(filterFlagName, common.AutocompleteSecretFilters)

noHeadingFlagName := "noheading"
flags.BoolVar(&listFlag.noHeading, noHeadingFlagName, false, "Do not print headers")
flags.BoolVarP(&listFlag.noHeading, noHeadingFlagName, "n", false, "Do not print headers")

quietFlagName := "quiet"
flags.BoolVarP(&listFlag.quiet, quietFlagName, "q", false, "Print secret IDs only")
Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/volumes/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func init() {
flags.StringVar(&cliOpts.Format, formatFlagName, "{{range .}}{{.Driver}}\t{{.Name}}\n{{end -}}", "Format volume output using Go template")
_ = lsCommand.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&entities.VolumeListReport{}))

flags.Bool("noheading", false, "Do not print headers")
flags.BoolP("noheading", "n", false, "Do not print headers")
flags.BoolVarP(&cliOpts.Quiet, "quiet", "q", false, "Print volume output in quiet mode")
}

Expand Down
9 changes: 8 additions & 1 deletion docs/source/markdown/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ podman-auto-update.1.md
podman-build.1.md
podman-container-clone.1.md
podman-container-diff.1.md
podman-container-runlabel.1.md
podman-container-inspect.1.md
podman-container-runlabel.1.md
podman-create.1.md
podman-diff.1.md
podman-exec.1.md
podman-image-sign.1.md
podman-image-trust.1.md
podman-images.1.md
podman-init.1.md
podman-init.1.md
podman-inspect.1.md
Expand All @@ -17,12 +19,14 @@ podman-kube-play.1.md
podman-login.1.md
podman-logout.1.md
podman-logs.1.md
podman-machine-list.1.md
podman-manifest-add.1.md
podman-manifest-annotate.1.md
podman-manifest-create.1.md
podman-manifest-inspect.1.md
podman-manifest-push.1.md
podman-mount.1.md
podman-network-ls.1.md
podman-network-reload.1.md
podman-pause.1.md
podman-pod-clone.1.md
Expand All @@ -31,6 +35,7 @@ podman-pod-inspect.1.md
podman-pod-inspect.1.md
podman-pod-kill.1.md
podman-pod-logs.1.md
podman-pod-ps.1.md
podman-pod-rm.1.md
podman-pod-start.1.md
podman-pod-stats.1.md
Expand All @@ -43,11 +48,13 @@ podman-restart.1.md
podman-rm.1.md
podman-run.1.md
podman-search.1.md
podman-secret-ls.1.md
podman-start.1.md
podman-stats.1.md
podman-stop.1.md
podman-top.1.md
podman-unmount.1.md
podman-unpause.1.md
podman-update.1.md
podman-volume-ls.1.md
podman-wait.1.md
7 changes: 7 additions & 0 deletions docs/source/markdown/options/noheading.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
####> This option file is used in:
####> podman image trust, images, machine list, network ls, pod ps, secret ls, volume ls
####> If file is edited, make sure the changes
####> are applicable to all of those.
#### **--noheading**, **-n**

Omit the table headings from the listing.
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ Trust may be updated using the command **podman image trust set** for an existin
#### **--json**, **-j**
Output trust as JSON for machine parsing

#### **--noheading**, **-n**
Omit the table headings from the trust listings
@@option noheading

#### **--raw**
Output trust policy file as raw JSON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ Display the history of image names. If an image gets re-tagged or untagged, the

Do not truncate the output (default *false*).

#### **--noheading**, **-n**

Omit the table headings from the listing of images.
@@option noheading

#### **--quiet**, **-q**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ Valid placeholders for the Go template are listed below:

Print usage statement.

#### **--noheading**

Omit the table headings from the listing of machines
@@option noheading

#### **--quiet**, **-q**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ Valid placeholders for the Go template are listed below:

Do not truncate the network ID.

#### **--noheading**

Omit the table headings from the listing of networks.
@@option noheading

#### **--quiet**, **-q**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ Display namespace information of the pod

Do not truncate the output (default *false*).

#### **--noheading**

Omit the table headings from the listing of pods.
@@option noheading

#### **--quiet**, **-q**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ Valid filters are listed below:

Format secret output using Go template.

#### **--noheading**

Omit the table headings from the listing of secrets.
@@option noheading

#### **--quiet**, **-q**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ Format volume output using Go template.

Print usage statement.

#### **--noheading**

Omit the table headings from the listing of volumes.
@@option noheading

#### **--quiet**, **-q**

Expand Down
12 changes: 11 additions & 1 deletion test/e2e/secret_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,17 @@ var _ = Describe("Podman secret", func() {
secret1 := "Secret1"
secret2 := "Secret2"

session := podmanTest.Podman([]string{"secret", "create", secret1, secretFilePath})
session := podmanTest.Podman([]string{"secret", "ls", "-n"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(""))

session = podmanTest.Podman([]string{"secret", "ls", "--noheading"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal(""))

session = podmanTest.Podman([]string{"secret", "create", secret1, secretFilePath})
session.WaitWithDefaultTimeout()
secrID1 := session.OutputToString()
Expect(session).Should(Exit(0))
Expand Down
2 changes: 2 additions & 0 deletions test/system/160-volumes.bats
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ function teardown() {
@test "podman run --volumes : basic" {
run_podman volume list --noheading
is "$output" "" "baseline: empty results from list --noheading"
run_podman volume list -n
is "$output" "" "baseline: empty results from list -n"

# Create three temporary directories
vol1=${PODMAN_TMPDIR}/v1_$(random_string)
Expand Down
4 changes: 2 additions & 2 deletions test/system/200-pod.bats
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ function teardown() {
run_podman pod list --noheading
is "$output" "" "baseline: empty results from list --noheading"

run_podman pod ls --noheading
is "$output" "" "baseline: empty results from ls --noheading"
run_podman pod ls -n
is "$output" "" "baseline: empty results from ls -n"

run_podman pod ps --noheading
is "$output" "" "baseline: empty results from ps --noheading"
Expand Down
3 changes: 3 additions & 0 deletions test/system/500-networking.bats
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ load helpers.network
run_podman network ls --noheading
assert "$output" !~ "$heading" "network ls --noheading shows header anyway"

run_podman network ls -n
assert "$output" !~ "$heading" "network ls -n shows header anyway"

# check deterministic list order
local net1=a-$(random_string 10)
local net2=b-$(random_string 10)
Expand Down

0 comments on commit fb967aa

Please sign in to comment.