Skip to content

Commit

Permalink
Add no-trunc support to podman-events
Browse files Browse the repository at this point in the history
Standardize on no-trunc through the code.
Alias notruncate where necessary.

Standardize on the man page display of no-trunc.

Fixes: containers#8941

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
  • Loading branch information
rhatdan committed Sep 16, 2021
1 parent 9119a57 commit 4216f7b
Show file tree
Hide file tree
Showing 29 changed files with 114 additions and 85 deletions.
3 changes: 2 additions & 1 deletion cmd/podman/containers/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ func mountFlags(cmd *cobra.Command) {
flags.StringVar(&mountOpts.Format, formatFlagName, "", "Print the mounted containers in specified format (json)")
_ = cmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(nil))

flags.BoolVar(&mountOpts.NoTruncate, "notruncate", false, "Do not truncate output")
flags.BoolVar(&mountOpts.NoTruncate, "no-trunc", false, "Do not truncate output")
flags.SetNormalizeFunc(utils.AliasFlags)
}

func init() {
Expand Down
3 changes: 2 additions & 1 deletion cmd/podman/images/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/containers/common/pkg/report"
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/utils"
"github.com/containers/podman/v3/pkg/domain/entities"
"github.com/docker/go-units"
"github.com/pkg/errors"
Expand Down Expand Up @@ -73,8 +74,8 @@ func historyFlags(cmd *cobra.Command) {

flags.BoolVarP(&opts.human, "human", "H", true, "Display sizes and dates in human readable format")
flags.BoolVar(&opts.noTrunc, "no-trunc", false, "Do not truncate the output")
flags.BoolVar(&opts.noTrunc, "notruncate", false, "Do not truncate the output")
flags.BoolVarP(&opts.quiet, "quiet", "q", false, "Display the numeric IDs only")
flags.SetNormalizeFunc(utils.AliasFlags)
}

func history(cmd *cobra.Command, args []string) error {
Expand Down
5 changes: 4 additions & 1 deletion cmd/podman/system/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ var (
var (
eventOptions entities.EventsOptions
eventFormat string
noTrunc bool
)

func init() {
Expand All @@ -58,6 +59,8 @@ func init() {
flags.StringVar(&eventOptions.Since, sinceFlagName, "", "show all events created since timestamp")
_ = eventsCommand.RegisterFlagCompletionFunc(sinceFlagName, completion.AutocompleteNone)

flags.BoolVar(&noTrunc, "no-trunc", true, "do not truncate the output")

untilFlagName := "until"
flags.StringVar(&eventOptions.Until, untilFlagName, "", "show all events until timestamp")
_ = eventsCommand.RegisterFlagCompletionFunc(untilFlagName, completion.AutocompleteNone)
Expand Down Expand Up @@ -110,7 +113,7 @@ func eventsCmd(cmd *cobra.Command, _ []string) error {
}
fmt.Println("")
default:
fmt.Println(event.ToHumanReadable())
fmt.Println(event.ToHumanReadable(!noTrunc))
}
}

Expand Down
2 changes: 2 additions & 0 deletions cmd/podman/utils/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ func AliasFlags(f *pflag.FlagSet, name string) pflag.NormalizedName {
name = "external"
case "purge":
name = "rm"
case "notruncate":
name = "no-trunc"
case "override-arch":
name = "arch"
case "override-os":
Expand Down
4 changes: 2 additions & 2 deletions docs/source/markdown/podman-auto-update.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ If the authorization state is not found there, `$HOME/.docker/config.json` is ch

Note: There is also the option to override the default path of the authentication file by setting the `REGISTRY_AUTH_FILE` environment variable. This can be done with **export REGISTRY_AUTH_FILE=_path_**.

#### **--dry-run**=*true|false*
#### **--dry-run**

Check for the availability of new images but do not perform any pull operation or restart any service or container.
The `UPDATED` field indicates the availability of a new image with "pending".
Expand All @@ -51,7 +51,7 @@ The `UPDATED` field indicates the availability of a new image with "pending".
Change the default output format. This can be of a supported type like 'json' or a Go template.
Valid placeholders for the Go template are listed below:

#### **--rollback**=*true|false*
#### **--rollback**

If restarting a systemd unit after updating the image has failed, rollback to using the previous image and restart the unit another time. Default is true.

Expand Down
6 changes: 3 additions & 3 deletions docs/source/markdown/podman-build.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ context.

If you specify `-f -`, the Containerfile contents will be read from stdin.

#### **--force-rm**=*true|false*
#### **--force-rm**

Always remove intermediate containers after a build, even if the build fails
(default true).
Expand Down Expand Up @@ -474,7 +474,7 @@ Suppress output messages which indicate which instruction is being processed,
and of progress when pulling images from a registry, and when writing the
output image.

#### **--rm**=*true|false*
#### **--rm**

Remove intermediate containers after a successful build (default true).

Expand Down Expand Up @@ -579,7 +579,7 @@ specified and therefore not changed, allowing the image's sha256 hash to remain
same. All files committed to the layers of the image will be created with the
timestamp.

#### **--tls-verify**=*true|false*
#### **--tls-verify**

Require HTTPS and verify certificates when talking to container registries
(defaults to true). (This option is not available with the remote Podman client)
Expand Down
2 changes: 1 addition & 1 deletion docs/source/markdown/podman-cp.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Further note that `podman cp` does not support globbing (e.g., `cp dir/*.txt`).

## OPTIONS

#### **--archive**, **-a**=**true** | *false*
#### **--archive**, **-a**

Archive mode (copy all uid/gid information).
When set to true, files copied to a container will have changed ownership to the primary UID/GID of the container.
Expand Down
28 changes: 14 additions & 14 deletions docs/source/markdown/podman-create.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ This option allows arbitrary environment variables that are available for the pr

See [**Environment**](#environment) note below for precedence and examples.

#### **--env-host**=*true|false*
#### **--env-host**

Use host environment inside of the container. See **Environment** note below for precedence. (This option is not available with the remote Podman client)

Expand Down Expand Up @@ -414,7 +414,7 @@ Sets the container host name that is available inside the container. Can only be

Print usage statement

#### **--http-proxy**=*true|false*
#### **--http-proxy**

By default proxy environment variables are passed into the container if set
for the Podman process. This can be disabled by setting the `--http-proxy`
Expand Down Expand Up @@ -465,7 +465,7 @@ pod when that pod is not running.

Path to the container-init binary.

#### **--interactive**, **-i**=*true|false*
#### **--interactive**, **-i**

Keep STDIN open even if not attached. The default is *false*.

Expand Down Expand Up @@ -684,18 +684,18 @@ Valid _mode_ values are:

Add network-scoped alias for the container

#### **--no-healthcheck**=*true|false*
#### **--no-healthcheck**

Disable any defined healthchecks for container.

#### **--no-hosts**=*true|false*
#### **--no-hosts**

Do not create /etc/hosts for the container.
By default, Podman will manage /etc/hosts, adding the container's own IP address and any hosts from **--add-host**.
#### **--no-hosts** disables this, and the image's **/etc/host** will be preserved unmodified.
This option conflicts with **--add-host**.

#### **--oom-kill-disable**=*true|false*
#### **--oom-kill-disable**

Whether to disable OOM Killer for the container or not.

Expand Down Expand Up @@ -737,7 +737,7 @@ To make a pod with more granular options, use the `podman pod create` command be

Run container in an existing pod and read the pod's ID from the specified file. If a container is run within a pod, and the pod has an infra-container, the infra-container will be started before the container is.

#### **--privileged**=*true|false*
#### **--privileged**

Give extended privileges to this container. The default is *false*.

Expand Down Expand Up @@ -776,7 +776,7 @@ associated ports. If one container binds to a port, no other container can use t
within the pod while it is in use. Containers in the pod can also communicate over localhost
by having one container bind to localhost in the pod, and another connect to that port.

#### **--publish-all**, **-P**=*true|false*
#### **--publish-all**, **-P**

Publish all exposed ports to random ports on the host interfaces. The default is *false*.

Expand All @@ -801,19 +801,19 @@ Defaults to *missing*.

Suppress output information when pulling images

#### **--read-only**=*true|false*
#### **--read-only**

Mount the container's root filesystem as read only.

By default a container will have its root filesystem writable allowing processes
to write files anywhere. By specifying the `--read-only` flag the container will have
its root filesystem mounted as read only prohibiting any writes.

#### **--read-only-tmpfs**=*true|false*
#### **--read-only-tmpfs**

If container is running in --read-only mode, then mount a read-write tmpfs on /run, /tmp, and /var/tmp. The default is *true*

#### **--replace**=**true**|**false**
#### **--replace**

If another container with the same name already exists, replace and remove it. The default is **false**.

Expand All @@ -839,7 +839,7 @@ Please note that restart will not restart containers after a system reboot.
If this functionality is required in your environment, you can invoke Podman from a systemd unit file, or create an init script for whichever init system is in use.
To generate systemd unit files, please see *podman generate systemd*

#### **--rm**=*true|false*
#### **--rm**

Automatically remove the container when it exits. The default is *false*.

Expand Down Expand Up @@ -1001,7 +1001,7 @@ Maximum time a container is allowed to run before conmon sends it the kill
signal. By default containers will run until they exit or are stopped by
`podman stop`.

#### **--tls-verify**=**true**|**false**
#### **--tls-verify**

Require HTTPS and verify certificates when contacting registries (default: true). If explicitly set to true, then TLS verification will be used. If set to false, then TLS verification will not be used. If not specified, TLS verification will be used unless the target registry is listed as an insecure registry in registries.conf.

Expand All @@ -1018,7 +1018,7 @@ options are the same as the Linux default `mount` flags. If you do not specify
any options, the systems uses the following options:
`rw,noexec,nosuid,nodev`.

#### **--tty**, **-t**=*true|false*
#### **--tty**, **-t**

Allocate a pseudo-TTY. The default is *false*.

Expand Down
4 changes: 4 additions & 0 deletions docs/source/markdown/podman-events.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ filters are supported:

In the case where an ID is used, the ID may be in its full or shortened form.

#### **--no-trunc**

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

#### **--since**=*timestamp*

Show all events created since the given timestamp
Expand Down
2 changes: 1 addition & 1 deletion docs/source/markdown/podman-exec.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ command to be executed.

Read in a line delimited file of environment variables.

#### **--interactive**, **-i**=*true|false*
#### **--interactive**, **-i**

When set to true, keep stdin open even if not attached. The default is *false*.

Expand Down
10 changes: 3 additions & 7 deletions docs/source/markdown/podman-history.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,15 @@ Valid placeholders for the Go template are listed below:

## OPTIONS

#### **--human**, **-H**=*true|false*
#### **--human**, **-H**

Display sizes and dates in human readable format (default *true*).

#### **--no-trunc**=*true|false*
#### **--no-trunc**

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

#### **--notruncate**

Do not truncate the output

#### **--quiet**, **-q**=*true|false*
#### **--quiet**, **-q**

Print the numeric IDs only (default *false*).
#### **--format**=*format*
Expand Down
8 changes: 4 additions & 4 deletions docs/source/markdown/podman-images.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ Filter output based on conditions provided
**before=IMAGE**
Filter on images created before the given IMAGE (name or tag).

**dangling=true|false**
**dangling
Show dangling images. Dangling images are a file system layer that was used in a previous build of an image and is no longer referenced by any image. They are denoted with the `<none>` tag, consume disk space and serve no active purpose.

**label**
Filter by images labels key and/or value.

**readonly=true|false**
**readonly
Show only read only images or Read/Write images. The default is to show both. Read/Only images can be configured by modifying the "additionalimagestores" in the /etc/containers/storage.conf file.

**reference=**
Expand Down Expand Up @@ -74,13 +74,13 @@ Omit the table headings from the listing of images.

#### **--no-trunc**

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

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

Lists only the image IDs.

#### **--sort**=*sort*
#### **--sort**=*sort*=*created*

Sort by created, id, repository, size or tag (default: created)

Expand Down
2 changes: 1 addition & 1 deletion docs/source/markdown/podman-login.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Password for registry

Take the password from stdin

#### **--tls-verify**=*true|false*
#### **--tls-verify**

Require HTTPS and verify certificates when contacting registries (default: true). If explicitly set to true,
then TLS verification will be used. If set to false, then TLS verification will not be used. If not specified,
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 @@ -40,9 +40,9 @@ Instead of providing the container name or ID, use the last created container.
If you use methods other than Podman to run containers such as CRI-O, the last
started container could be from either of those methods. (This option is not available with the remote Podman client)

#### **--notruncate**
#### **--no-trunc**

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

## EXAMPLE

Expand Down
4 changes: 2 additions & 2 deletions docs/source/markdown/podman-play-kube.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ Suppress output information when pulling images

Directory path for seccomp profiles (default: "/var/lib/kubelet/seccomp"). (This option is not available with the remote Podman client)

#### **--start**=*true|false*
#### **--start**

Start the pod after creating it, set to false to only create it.

#### **--tls-verify**=*true|false*
#### **--tls-verify**

Require HTTPS and verify certificates when contacting registries (default: true). If explicitly set to true,
then TLS verification will be used. If set to false, then TLS verification will not be used. If not specified,
Expand Down
6 changes: 3 additions & 3 deletions docs/source/markdown/podman-pod-create.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Print usage statement.

Set a hostname to the pod

#### **--infra**=**true**|**false**
#### **--infra**

Create an infra container and associate it with the pod. An infra container is a lightweight container used to coordinate the shared kernel namespace of a pod. Default: true.

Expand Down Expand Up @@ -143,7 +143,7 @@ Set network mode for the pod. Supported values are:

Add a DNS alias for the container. When the container is joined to a CNI network with support for the dnsname plugin, the container will be accessible through this name from other containers in the network.

#### **--no-hosts**=**true**|**false**
#### **--no-hosts**

Disable creation of /etc/hosts for the pod.

Expand All @@ -170,7 +170,7 @@ Use `podman port` to see the actual mapping: `podman port CONTAINER $CONTAINERPO

NOTE: This cannot be modified once the pod is created.

#### **--replace**=**true**|**false**
#### **--replace**

If another pod with the same name already exists, replace and remove it. The default is **false**.

Expand Down
2 changes: 1 addition & 1 deletion docs/source/markdown/podman-pod-ps.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Omit the table headings from the listing of pods.

#### **--no-trunc**

Display the extended information
Do not truncate the output (default *false*).

#### **--ns**

Expand Down
Loading

0 comments on commit 4216f7b

Please sign in to comment.