mirror of
https://github.com/containers/podman.git
synced 2025-06-19 16:33:24 +08:00
Sort all command flags
Signed-off-by: Qi Wang <qiwan@redhat.com>
This commit is contained in:
@ -30,7 +30,7 @@ var (
|
||||
Name: "attach",
|
||||
Usage: "Attach to a running container",
|
||||
Description: attachDescription,
|
||||
Flags: attachFlags,
|
||||
Flags: sortFlags(attachFlags),
|
||||
Action: attachCmd,
|
||||
ArgsUsage: "",
|
||||
OnUsageError: usageErrorHandler,
|
||||
|
@ -29,7 +29,7 @@ var (
|
||||
Name: "build",
|
||||
Usage: "Build an image using instructions from Dockerfiles",
|
||||
Description: buildDescription,
|
||||
Flags: append(append(buildahcli.BudFlags, layerFlags...), buildahcli.FromAndBudFlags...),
|
||||
Flags: sortFlags(append(append(buildahcli.BudFlags, layerFlags...), buildahcli.FromAndBudFlags...)),
|
||||
Action: buildCmd,
|
||||
ArgsUsage: "CONTEXT-DIRECTORY | URL",
|
||||
SkipArgReorder: true,
|
||||
|
@ -27,7 +27,7 @@ var (
|
||||
Name: "checkpoint",
|
||||
Usage: "Checkpoints one or more containers",
|
||||
Description: checkpointDescription,
|
||||
Flags: checkpointFlags,
|
||||
Flags: sortFlags(checkpointFlags),
|
||||
Action: checkpointCmd,
|
||||
ArgsUsage: "CONTAINER-NAME [CONTAINER-NAME ...]",
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ var (
|
||||
Name: "cleanup",
|
||||
Usage: "Cleanup network and mountpoints of one or more containers",
|
||||
Description: cleanupDescription,
|
||||
Flags: cleanupFlags,
|
||||
Flags: sortFlags(cleanupFlags),
|
||||
Action: cleanupCmd,
|
||||
ArgsUsage: "CONTAINER-NAME [CONTAINER-NAME ...]",
|
||||
OnUsageError: usageErrorHandler,
|
||||
|
@ -52,7 +52,7 @@ var (
|
||||
Name: "commit",
|
||||
Usage: "Create new image based on the changed container",
|
||||
Description: commitDescription,
|
||||
Flags: commitFlags,
|
||||
Flags: sortFlags(commitFlags),
|
||||
Action: commitCmd,
|
||||
ArgsUsage: "CONTAINER [REPOSITORY[:TAG]]",
|
||||
OnUsageError: usageErrorHandler,
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"os"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/containers/buildah"
|
||||
@ -446,3 +447,10 @@ func getFormat(c *cli.Context) (string, error) {
|
||||
}
|
||||
return "", errors.Errorf("unrecognized image type %q", format)
|
||||
}
|
||||
|
||||
func sortFlags(flags []cli.Flag) []cli.Flag {
|
||||
sort.Slice(flags, func(i, j int) bool {
|
||||
return strings.Compare(flags[i].GetName(), flags[j].GetName()) < 0
|
||||
})
|
||||
return flags
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ var createCommand = cli.Command{
|
||||
Name: "create",
|
||||
Usage: "Create but do not start a container",
|
||||
Description: createDescription,
|
||||
Flags: createFlags,
|
||||
Flags: sortFlags(createFlags),
|
||||
Action: createCmd,
|
||||
ArgsUsage: "IMAGE [COMMAND [ARG...]]",
|
||||
HideHelp: true,
|
||||
|
@ -51,7 +51,7 @@ var (
|
||||
Name: "diff",
|
||||
Usage: "Inspect changes on container's file systems",
|
||||
Description: diffDescription,
|
||||
Flags: diffFlags,
|
||||
Flags: sortFlags(diffFlags),
|
||||
Action: diffCmd,
|
||||
ArgsUsage: "ID-NAME",
|
||||
OnUsageError: usageErrorHandler,
|
||||
|
@ -46,7 +46,7 @@ var (
|
||||
Name: "exec",
|
||||
Usage: "Run a process in a running container",
|
||||
Description: execDescription,
|
||||
Flags: execFlags,
|
||||
Flags: sortFlags(execFlags),
|
||||
Action: execCmd,
|
||||
ArgsUsage: "CONTAINER-NAME",
|
||||
SkipArgReorder: true,
|
||||
|
@ -23,7 +23,7 @@ var (
|
||||
Name: "export",
|
||||
Usage: "Export container's filesystem contents as a tar archive",
|
||||
Description: exportDescription,
|
||||
Flags: exportFlags,
|
||||
Flags: sortFlags(exportFlags),
|
||||
Action: exportCmd,
|
||||
ArgsUsage: "CONTAINER",
|
||||
OnUsageError: usageErrorHandler,
|
||||
|
@ -59,7 +59,7 @@ var (
|
||||
Name: "history",
|
||||
Usage: "Show history of a specified image",
|
||||
Description: historyDescription,
|
||||
Flags: historyFlags,
|
||||
Flags: sortFlags(historyFlags),
|
||||
Action: historyCmd,
|
||||
ArgsUsage: "",
|
||||
UseShortOptionHandling: true,
|
||||
|
@ -124,7 +124,7 @@ var (
|
||||
Name: "images",
|
||||
Usage: "List images in local storage",
|
||||
Description: imagesDescription,
|
||||
Flags: imagesFlags,
|
||||
Flags: sortFlags(imagesFlags),
|
||||
Action: imagesCmd,
|
||||
ArgsUsage: "",
|
||||
UseShortOptionHandling: true,
|
||||
|
@ -39,7 +39,7 @@ var (
|
||||
Name: "import",
|
||||
Usage: "Import a tarball to create a filesystem image",
|
||||
Description: importDescription,
|
||||
Flags: importFlags,
|
||||
Flags: sortFlags(importFlags),
|
||||
Action: importCmd,
|
||||
ArgsUsage: "TARBALL [REFERENCE]",
|
||||
OnUsageError: usageErrorHandler,
|
||||
|
@ -16,7 +16,7 @@ var (
|
||||
Name: "info",
|
||||
Usage: infoDescription,
|
||||
Description: `Information display here pertain to the host, current storage stats, and build of podman. Useful for the user and when reporting issues.`,
|
||||
Flags: infoFlags,
|
||||
Flags: sortFlags(infoFlags),
|
||||
Action: infoCmd,
|
||||
ArgsUsage: "",
|
||||
OnUsageError: usageErrorHandler,
|
||||
|
@ -41,7 +41,7 @@ var (
|
||||
Name: "inspect",
|
||||
Usage: "Displays the configuration of a container or image",
|
||||
Description: inspectDescription,
|
||||
Flags: inspectFlags,
|
||||
Flags: sortFlags(inspectFlags),
|
||||
Action: inspectCmd,
|
||||
ArgsUsage: "CONTAINER-OR-IMAGE [CONTAINER-OR-IMAGE]...",
|
||||
OnUsageError: usageErrorHandler,
|
||||
|
@ -31,7 +31,7 @@ var (
|
||||
Name: "kill",
|
||||
Usage: "Kill one or more running containers with a specific signal",
|
||||
Description: killDescription,
|
||||
Flags: killFlags,
|
||||
Flags: sortFlags(killFlags),
|
||||
Action: killCmd,
|
||||
ArgsUsage: "CONTAINER-NAME [CONTAINER-NAME ...]",
|
||||
UseShortOptionHandling: true,
|
||||
|
@ -36,7 +36,7 @@ var (
|
||||
Name: "load",
|
||||
Usage: "Load an image from docker archive",
|
||||
Description: loadDescription,
|
||||
Flags: loadFlags,
|
||||
Flags: sortFlags(loadFlags),
|
||||
Action: loadCmd,
|
||||
ArgsUsage: "",
|
||||
OnUsageError: usageErrorHandler,
|
||||
|
@ -43,7 +43,7 @@ var (
|
||||
Name: "login",
|
||||
Usage: "Login to a container registry",
|
||||
Description: loginDescription,
|
||||
Flags: loginFlags,
|
||||
Flags: sortFlags(loginFlags),
|
||||
Action: loginCmd,
|
||||
ArgsUsage: "REGISTRY",
|
||||
OnUsageError: usageErrorHandler,
|
||||
|
@ -25,7 +25,7 @@ var (
|
||||
Name: "logout",
|
||||
Usage: "Logout of a container registry",
|
||||
Description: logoutDescription,
|
||||
Flags: logoutFlags,
|
||||
Flags: sortFlags(logoutFlags),
|
||||
Action: logoutCmd,
|
||||
ArgsUsage: "REGISTRY",
|
||||
OnUsageError: usageErrorHandler,
|
||||
|
@ -43,7 +43,7 @@ var (
|
||||
Name: "logs",
|
||||
Usage: "Fetch the logs of a container",
|
||||
Description: logsDescription,
|
||||
Flags: logsFlags,
|
||||
Flags: sortFlags(logsFlags),
|
||||
Action: logsCmd,
|
||||
ArgsUsage: "CONTAINER",
|
||||
SkipArgReorder: true,
|
||||
|
@ -36,7 +36,7 @@ var (
|
||||
Description: mountDescription,
|
||||
Action: mountCmd,
|
||||
ArgsUsage: "[CONTAINER-NAME-OR-ID [...]]",
|
||||
Flags: mountFlags,
|
||||
Flags: sortFlags(mountFlags),
|
||||
OnUsageError: usageErrorHandler,
|
||||
}
|
||||
)
|
||||
|
@ -69,7 +69,7 @@ var podCreateCommand = cli.Command{
|
||||
Name: "create",
|
||||
Usage: "Create a new empty pod",
|
||||
Description: podCreateDescription,
|
||||
Flags: podCreateFlags,
|
||||
Flags: sortFlags(podCreateFlags),
|
||||
Action: podCreateCmd,
|
||||
SkipArgReorder: true,
|
||||
UseShortOptionHandling: true,
|
||||
|
@ -19,7 +19,7 @@ var (
|
||||
Name: "inspect",
|
||||
Usage: "displays a pod configuration",
|
||||
Description: podInspectDescription,
|
||||
Flags: podInspectFlags,
|
||||
Flags: sortFlags(podInspectFlags),
|
||||
Action: podInspectCmd,
|
||||
UseShortOptionHandling: true,
|
||||
ArgsUsage: "[POD_NAME_OR_ID]",
|
||||
|
@ -29,7 +29,7 @@ var (
|
||||
Name: "kill",
|
||||
Usage: "Send the specified signal or SIGKILL to containers in pod",
|
||||
Description: podKillDescription,
|
||||
Flags: podKillFlags,
|
||||
Flags: sortFlags(podKillFlags),
|
||||
Action: podKillCmd,
|
||||
ArgsUsage: "[POD_NAME_OR_ID]",
|
||||
UseShortOptionHandling: true,
|
||||
|
@ -25,7 +25,7 @@ var (
|
||||
Name: "pause",
|
||||
Usage: "Pause one or more pods",
|
||||
Description: podPauseDescription,
|
||||
Flags: podPauseFlags,
|
||||
Flags: sortFlags(podPauseFlags),
|
||||
Action: podPauseCmd,
|
||||
ArgsUsage: "POD-NAME|POD-ID [POD-NAME|POD-ID ...]",
|
||||
UseShortOptionHandling: true,
|
||||
|
@ -161,7 +161,7 @@ var (
|
||||
Aliases: []string{"ls", "list"},
|
||||
Usage: "List pods",
|
||||
Description: podPsDescription,
|
||||
Flags: podPsFlags,
|
||||
Flags: sortFlags(podPsFlags),
|
||||
Action: podPsCmd,
|
||||
UseShortOptionHandling: true,
|
||||
OnUsageError: usageErrorHandler,
|
||||
|
@ -23,7 +23,7 @@ var (
|
||||
Name: "restart",
|
||||
Usage: "Restart one or more pods",
|
||||
Description: podRestartDescription,
|
||||
Flags: podRestartFlags,
|
||||
Flags: sortFlags(podRestartFlags),
|
||||
Action: podRestartCmd,
|
||||
ArgsUsage: "POD-NAME|POD-ID [POD-NAME|POD-ID ...]",
|
||||
UseShortOptionHandling: true,
|
||||
|
@ -30,7 +30,7 @@ If --force is specified, all containers will be stopped, then removed.
|
||||
Name: "rm",
|
||||
Usage: "Remove one or more pods",
|
||||
Description: podRmDescription,
|
||||
Flags: podRmFlags,
|
||||
Flags: sortFlags(podRmFlags),
|
||||
Action: podRmCmd,
|
||||
ArgsUsage: "[POD ...]",
|
||||
UseShortOptionHandling: true,
|
||||
|
@ -27,7 +27,7 @@ var (
|
||||
Name: "start",
|
||||
Usage: "Start one or more pods",
|
||||
Description: podStartDescription,
|
||||
Flags: podStartFlags,
|
||||
Flags: sortFlags(podStartFlags),
|
||||
Action: podStartCmd,
|
||||
ArgsUsage: "POD-NAME [POD-NAME ...]",
|
||||
UseShortOptionHandling: true,
|
||||
|
@ -39,7 +39,7 @@ var (
|
||||
Name: "stats",
|
||||
Usage: "Display percentage of CPU, memory, network I/O, block I/O and PIDs for containers in one or more pods",
|
||||
Description: podStatsDescription,
|
||||
Flags: podStatsFlags,
|
||||
Flags: sortFlags(podStatsFlags),
|
||||
Action: podStatsCmd,
|
||||
ArgsUsage: "[POD_NAME_OR_ID]",
|
||||
UseShortOptionHandling: true,
|
||||
|
@ -27,7 +27,7 @@ var (
|
||||
Name: "stop",
|
||||
Usage: "Stop one or more pods",
|
||||
Description: podStopDescription,
|
||||
Flags: podStopFlags,
|
||||
Flags: sortFlags(podStopFlags),
|
||||
Action: podStopCmd,
|
||||
ArgsUsage: "POD-NAME [POD-NAME ...]",
|
||||
OnUsageError: usageErrorHandler,
|
||||
|
@ -32,7 +32,7 @@ the latest pod.
|
||||
Name: "top",
|
||||
Usage: "Display the running processes of containers in a pod",
|
||||
Description: podTopDescription,
|
||||
Flags: podTopFlags,
|
||||
Flags: sortFlags(podTopFlags),
|
||||
Action: podTopCmd,
|
||||
ArgsUsage: "POD-NAME [format descriptors]",
|
||||
SkipArgReorder: true,
|
||||
|
@ -25,7 +25,7 @@ var (
|
||||
Name: "unpause",
|
||||
Usage: "Unpause one or more pods",
|
||||
Description: podUnpauseDescription,
|
||||
Flags: podUnpauseFlags,
|
||||
Flags: sortFlags(podUnpauseFlags),
|
||||
Action: podUnpauseCmd,
|
||||
ArgsUsage: "POD-NAME|POD-ID [POD-NAME|POD-ID ...]",
|
||||
UseShortOptionHandling: true,
|
||||
|
@ -29,7 +29,7 @@ var (
|
||||
Name: "port",
|
||||
Usage: "List port mappings or a specific mapping for the container",
|
||||
Description: portDescription,
|
||||
Flags: portFlags,
|
||||
Flags: sortFlags(portFlags),
|
||||
Action: portCmd,
|
||||
ArgsUsage: "CONTAINER-NAME [mapping]",
|
||||
OnUsageError: usageErrorHandler,
|
||||
|
@ -182,7 +182,7 @@ var (
|
||||
Name: "ps",
|
||||
Usage: "List containers",
|
||||
Description: psDescription,
|
||||
Flags: psFlags,
|
||||
Flags: sortFlags(psFlags),
|
||||
Action: psCmd,
|
||||
ArgsUsage: "",
|
||||
UseShortOptionHandling: true,
|
||||
|
@ -54,7 +54,7 @@ specified, the image with the 'latest' tag (if it exists) is pulled
|
||||
Name: "pull",
|
||||
Usage: "Pull an image from a registry",
|
||||
Description: pullDescription,
|
||||
Flags: pullFlags,
|
||||
Flags: sortFlags(pullFlags),
|
||||
Action: pullCmd,
|
||||
ArgsUsage: "",
|
||||
OnUsageError: usageErrorHandler,
|
||||
|
@ -70,7 +70,7 @@ var (
|
||||
Name: "push",
|
||||
Usage: "Push an image to a specified destination",
|
||||
Description: pushDescription,
|
||||
Flags: pushFlags,
|
||||
Flags: sortFlags(pushFlags),
|
||||
Action: pushCmd,
|
||||
ArgsUsage: "IMAGE DESTINATION",
|
||||
OnUsageError: usageErrorHandler,
|
||||
|
@ -18,7 +18,7 @@ var (
|
||||
Name: "refresh",
|
||||
Usage: "Refresh container state",
|
||||
Description: refreshDescription,
|
||||
Flags: refreshFlags,
|
||||
Flags: sortFlags(refreshFlags),
|
||||
Action: refreshCmd,
|
||||
UseShortOptionHandling: true,
|
||||
OnUsageError: usageErrorHandler,
|
||||
|
@ -26,7 +26,7 @@ var (
|
||||
Name: "restart",
|
||||
Usage: "Restart one or more containers",
|
||||
Description: restartDescription,
|
||||
Flags: restartFlags,
|
||||
Flags: sortFlags(restartFlags),
|
||||
Action: restartCmd,
|
||||
ArgsUsage: "CONTAINER [CONTAINER ...]",
|
||||
UseShortOptionHandling: true,
|
||||
|
@ -27,7 +27,7 @@ var (
|
||||
Name: "restore",
|
||||
Usage: "Restores one or more containers from a checkpoint",
|
||||
Description: restoreDescription,
|
||||
Flags: restoreFlags,
|
||||
Flags: sortFlags(restoreFlags),
|
||||
Action: restoreCmd,
|
||||
ArgsUsage: "CONTAINER-NAME [CONTAINER-NAME ...]",
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ Running containers will not be removed without the -f option.
|
||||
Name: "rm",
|
||||
Usage: "Remove one or more containers",
|
||||
Description: rmDescription,
|
||||
Flags: rmFlags,
|
||||
Flags: sortFlags(rmFlags),
|
||||
Action: rmCmd,
|
||||
ArgsUsage: "",
|
||||
UseShortOptionHandling: true,
|
||||
|
@ -29,7 +29,7 @@ var (
|
||||
Description: rmiDescription,
|
||||
Action: rmiCmd,
|
||||
ArgsUsage: "IMAGE-NAME-OR-ID [...]",
|
||||
Flags: rmiFlags,
|
||||
Flags: sortFlags(rmiFlags),
|
||||
UseShortOptionHandling: true,
|
||||
OnUsageError: usageErrorHandler,
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ var runCommand = cli.Command{
|
||||
Name: "run",
|
||||
Usage: "Run a command in a new container",
|
||||
Description: runDescription,
|
||||
Flags: runFlags,
|
||||
Flags: sortFlags(runFlags),
|
||||
Action: runCmd,
|
||||
ArgsUsage: "IMAGE [COMMAND [ARG...]]",
|
||||
HideHelp: true,
|
||||
|
@ -18,7 +18,7 @@ var (
|
||||
CLI *cli.Context
|
||||
testCommand = cli.Command{
|
||||
Name: "test",
|
||||
Flags: createFlags,
|
||||
Flags: sortFlags(createFlags),
|
||||
Action: testCmd,
|
||||
HideHelp: true,
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ Executes a command as described by a container image label.
|
||||
Name: "runlabel",
|
||||
Usage: "Execute the command described by an image label",
|
||||
Description: runlabelDescription,
|
||||
Flags: runlabelFlags,
|
||||
Flags: sortFlags(runlabelFlags),
|
||||
Action: runlabelCmd,
|
||||
ArgsUsage: "",
|
||||
SkipArgReorder: true,
|
||||
|
@ -53,7 +53,7 @@ var (
|
||||
Name: "save",
|
||||
Usage: "Save image to an archive",
|
||||
Description: saveDescription,
|
||||
Flags: saveFlags,
|
||||
Flags: sortFlags(saveFlags),
|
||||
Action: saveCmd,
|
||||
ArgsUsage: "",
|
||||
SkipArgReorder: true,
|
||||
|
@ -55,7 +55,7 @@ var (
|
||||
Name: "search",
|
||||
Usage: "Search registry for image",
|
||||
Description: searchDescription,
|
||||
Flags: searchFlags,
|
||||
Flags: sortFlags(searchFlags),
|
||||
Action: searchCmd,
|
||||
ArgsUsage: "TERM",
|
||||
OnUsageError: usageErrorHandler,
|
||||
|
@ -41,7 +41,7 @@ var (
|
||||
Name: "start",
|
||||
Usage: "Start one or more containers",
|
||||
Description: startDescription,
|
||||
Flags: startFlags,
|
||||
Flags: sortFlags(startFlags),
|
||||
Action: startCmd,
|
||||
ArgsUsage: "CONTAINER-NAME [CONTAINER-NAME ...]",
|
||||
UseShortOptionHandling: true,
|
||||
|
@ -52,7 +52,7 @@ var (
|
||||
Name: "stats",
|
||||
Usage: "Display percentage of CPU, memory, network I/O, block I/O and PIDs for one or more containers",
|
||||
Description: statsDescription,
|
||||
Flags: statsFlags,
|
||||
Flags: sortFlags(statsFlags),
|
||||
Action: statsCmd,
|
||||
ArgsUsage: "",
|
||||
OnUsageError: usageErrorHandler,
|
||||
|
@ -35,7 +35,7 @@ var (
|
||||
Name: "stop",
|
||||
Usage: "Stop one or more containers",
|
||||
Description: stopDescription,
|
||||
Flags: stopFlags,
|
||||
Flags: sortFlags(stopFlags),
|
||||
Action: stopCmd,
|
||||
ArgsUsage: "CONTAINER-NAME [CONTAINER-NAME ...]",
|
||||
OnUsageError: usageErrorHandler,
|
||||
|
@ -42,7 +42,7 @@ the latest container.
|
||||
Name: "top",
|
||||
Usage: "Display the running processes of a container",
|
||||
Description: topDescription,
|
||||
Flags: topFlags,
|
||||
Flags: sortFlags(topFlags),
|
||||
Action: topCmd,
|
||||
ArgsUsage: "CONTAINER-NAME [format descriptors]",
|
||||
SkipArgReorder: true,
|
||||
|
@ -35,7 +35,7 @@ An unmount can be forced with the --force flag.
|
||||
Aliases: []string{"unmount"},
|
||||
Usage: "Unmounts working container's root filesystem",
|
||||
Description: description,
|
||||
Flags: umountFlags,
|
||||
Flags: sortFlags(umountFlags),
|
||||
Action: umountCmd,
|
||||
ArgsUsage: "CONTAINER-NAME-OR-ID",
|
||||
OnUsageError: usageErrorHandler,
|
||||
|
@ -32,7 +32,7 @@ var (
|
||||
Name: "varlink",
|
||||
Usage: "Run varlink interface",
|
||||
Description: varlinkDescription,
|
||||
Flags: varlinkFlags,
|
||||
Flags: sortFlags(varlinkFlags),
|
||||
Action: varlinkCmd,
|
||||
ArgsUsage: "VARLINK_URI",
|
||||
OnUsageError: usageErrorHandler,
|
||||
|
@ -28,7 +28,7 @@ var (
|
||||
Name: "wait",
|
||||
Usage: "Block on one or more containers",
|
||||
Description: waitDescription,
|
||||
Flags: waitFlags,
|
||||
Flags: sortFlags(waitFlags),
|
||||
Action: waitCmd,
|
||||
ArgsUsage: "CONTAINER-NAME [CONTAINER-NAME ...]",
|
||||
OnUsageError: usageErrorHandler,
|
||||
|
Reference in New Issue
Block a user