mirror of
https://github.com/containers/podman.git
synced 2025-06-20 00:51:16 +08:00
Add podman system events alias to podman events
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -16,13 +16,13 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
eventsDescription = `Monitor podman events.
|
||||
eventsDescription = `Monitor podman system events.
|
||||
|
||||
By default, streaming mode is used, printing new events as they occur. Previous events can be listed via --since and --until.`
|
||||
eventsCommand = &cobra.Command{
|
||||
Use: "events [options]",
|
||||
Args: validate.NoArgs,
|
||||
Short: "Show podman events",
|
||||
Short: "Show podman system events",
|
||||
Long: eventsDescription,
|
||||
RunE: eventsCmd,
|
||||
ValidArgsFunction: completion.AutocompleteNone,
|
||||
@ -31,6 +31,16 @@ var (
|
||||
podman events --format {{.Image}}
|
||||
podman events --since 1h30s`,
|
||||
}
|
||||
|
||||
systemEventsCommand = &cobra.Command{
|
||||
Args: eventsCommand.Args,
|
||||
Use: eventsCommand.Use,
|
||||
Short: eventsCommand.Short,
|
||||
Long: eventsCommand.Long,
|
||||
RunE: eventsCommand.RunE,
|
||||
ValidArgsFunction: eventsCommand.ValidArgsFunction,
|
||||
Example: `podman system events`,
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
@ -40,30 +50,39 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Command: systemEventsCommand,
|
||||
Parent: systemCmd,
|
||||
})
|
||||
eventsFlags(systemEventsCommand)
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Command: eventsCommand,
|
||||
})
|
||||
flags := eventsCommand.Flags()
|
||||
eventsFlags(eventsCommand)
|
||||
}
|
||||
|
||||
func eventsFlags(cmd *cobra.Command) {
|
||||
flags := cmd.Flags()
|
||||
|
||||
filterFlagName := "filter"
|
||||
flags.StringArrayVarP(&eventOptions.Filter, filterFlagName, "f", []string{}, "filter output")
|
||||
_ = eventsCommand.RegisterFlagCompletionFunc(filterFlagName, common.AutocompleteEventFilter)
|
||||
_ = cmd.RegisterFlagCompletionFunc(filterFlagName, common.AutocompleteEventFilter)
|
||||
|
||||
formatFlagName := "format"
|
||||
flags.StringVar(&eventFormat, formatFlagName, "", "format the output using a Go template")
|
||||
_ = eventsCommand.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&events.Event{}))
|
||||
_ = cmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&events.Event{}))
|
||||
|
||||
flags.BoolVar(&eventOptions.Stream, "stream", true, "stream new events; for testing only")
|
||||
|
||||
sinceFlagName := "since"
|
||||
flags.StringVar(&eventOptions.Since, sinceFlagName, "", "show all events created since timestamp")
|
||||
_ = eventsCommand.RegisterFlagCompletionFunc(sinceFlagName, completion.AutocompleteNone)
|
||||
_ = cmd.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)
|
||||
_ = cmd.RegisterFlagCompletionFunc(untilFlagName, completion.AutocompleteNone)
|
||||
|
||||
_ = flags.MarkHidden("stream")
|
||||
}
|
||||
|
@ -90,6 +90,7 @@
|
||||
| [podman-stop(1)](https://podman.readthedocs.io/en/latest/markdown/podman-stop.1.html) | Stops one or more running containers |
|
||||
| [podman-system(1)](https://podman.readthedocs.io/en/latest/system.html) | Manage podman |
|
||||
| [podman-system-df(1)](https://podman.readthedocs.io/en/latest/markdown/podman-system-df.1.html) | Show podman disk usage. |
|
||||
| [podman-system-events(1)](https://podman.readthedocs.io/en/latest/markdown/podman-events.1.html) | Displays Podman related system events. |
|
||||
| [podman-system-info(1)](https://podman.readthedocs.io/en/latest/markdown/podman-info.1.html) | Displays Podman related system information. |
|
||||
| [podman-system-migrate(1)](https://podman.readthedocs.io/en/latest/markdown/podman-system-migrate.1.html) | Migrate existing containers to a new podman version |
|
||||
| [podman-system-prune(1)](https://podman.readthedocs.io/en/latest/markdown/podman-system-prune.1.html) | Remove all unused container, image and volume data |
|
||||
|
1
docs/source/markdown/links/podman-system-events.1
Normal file
1
docs/source/markdown/links/podman-system-events.1
Normal file
@ -0,0 +1 @@
|
||||
.so man1/podman-events.1
|
@ -6,6 +6,8 @@ podman\-events - Monitor Podman events
|
||||
## SYNOPSIS
|
||||
**podman events** [*options*]
|
||||
|
||||
**podman system events** [*options*]
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
Monitor and print events that occur in Podman. Each event will include a timestamp,
|
||||
|
@ -15,6 +15,7 @@ The system command allows you to manage the podman systems
|
||||
| ------- | ------------------------------------------------------------ | ------------------------------------------------------------------------ |
|
||||
| connection | [podman-system-connection(1)](podman-system-connection.1.md) | Manage the destination(s) for Podman service(s) |
|
||||
| df | [podman-system-df(1)](podman-system-df.1.md) | Show podman disk usage. |
|
||||
| events | [podman-system-events(1)](podman-events.1.md) | Monitor Podman events |
|
||||
| info | [podman-system-info(1)](podman-info.1.md) | Displays Podman related system information. |
|
||||
| migrate | [podman-system-migrate(1)](podman-system-migrate.1.md) | Migrate existing containers to a new podman version. |
|
||||
| prune | [podman-system-prune(1)](podman-system-prune.1.md) | Remove all unused pods, containers, images, networks, and volume data. |
|
||||
|
@ -17,7 +17,7 @@ load helpers
|
||||
is "$output" "$expect" "filtering by container name and label"
|
||||
|
||||
# Same thing, but without the container-name filter
|
||||
run_podman events -f type=container --filter label=${labelname}=${labelvalue} --filter event=start --stream=false
|
||||
run_podman system events -f type=container --filter label=${labelname}=${labelvalue} --filter event=start --stream=false
|
||||
is "$output" "$expect" "filtering just by label"
|
||||
|
||||
# Now filter just by container name, no label
|
||||
|
@ -37,6 +37,7 @@ search | $IMAGE
|
||||
pod inspect | mypod
|
||||
|
||||
events | --stream=false --events-backend=file
|
||||
system events | --stream=false --events-backend=file
|
||||
"
|
||||
|
||||
# podman machine is finicky. Assume we can't run it, but see below for more.
|
||||
|
@ -87,6 +87,7 @@ There are other equivalents for these tools
|
||||
| `docker stop` | [`podman stop`](./docs/source/markdown/podman-stop.1.md) |
|
||||
| `docker system ` | [`podman system`](./docs/source/markdown/podman-system.1.md) |
|
||||
| `docker system df` | [`podman system df`](./docs/source/markdown/podman-system-df.1.md) |
|
||||
| `docker system events` | [`podman system events`](./docs/source/markdown/podman-events.1.md) |
|
||||
| `docker system info` | [`podman system info`](./docs/source/markdown/podman-system-info.1.md) |
|
||||
| `docker system prune` | [`podman system prune`](./docs/source/markdown/podman-system-prune.1.md)|
|
||||
| `docker tag` | [`podman tag`](./docs/source/markdown/podman-tag.1.md) |
|
||||
|
Reference in New Issue
Block a user