mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-09-09 17:17:53 +00:00
[NO TESTS NEEDED] This commit cleans up two issues: * Most commands support all EngineModes so default to that. Let outlayers declare their intent. * Use cobra.Annotations to set supported EngineMode. This simplies instantiating commands as there is now one method to communicate a commands requirements rather than two. * Combined aliased commands into one file * Fixed aliased commands where Args field did not match * Updated examples in README.md for writing commands * Remove redundant flag DisableFlagsInUseLine in cobra.Command initialization. Signed-off-by: Jhon Honce <jhonce@redhat.com>
33 lines
952 B
Go
33 lines
952 B
Go
package containers
|
|
|
|
import (
|
|
"github.com/containers/common/pkg/completion"
|
|
"github.com/containers/podman/v3/cmd/podman/registry"
|
|
"github.com/containers/podman/v3/cmd/podman/validate"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var (
|
|
// podman container _list_
|
|
listCmd = &cobra.Command{
|
|
Use: "list [options]",
|
|
Aliases: []string{"ls"},
|
|
Args: validate.NoArgs,
|
|
Short: "List containers",
|
|
Long: "Prints out information about the containers",
|
|
RunE: ps,
|
|
ValidArgsFunction: completion.AutocompleteNone,
|
|
Example: `podman container list -a
|
|
podman container list -a --format "{{.ID}} {{.Image}} {{.Labels}} {{.Mounts}}"
|
|
podman container list --size --sort names`,
|
|
}
|
|
)
|
|
|
|
func init() {
|
|
registry.Commands = append(registry.Commands, registry.CliCommand{
|
|
Command: listCmd,
|
|
Parent: containerCmd,
|
|
})
|
|
listFlagSet(listCmd)
|
|
validate.AddLatestFlag(listCmd, &listOpts.Latest)
|
|
}
|