summaryrefslogtreecommitdiff
path: root/cmd/podman/commands.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-01-31 13:20:04 -0600
committerbaude <bbaude@redhat.com>2019-02-08 10:26:43 -0600
commit25a3923b61a5ca014318e6d957f68abd03947297 (patch)
tree2ccb4a0bd9bda70c1c258dcb1b8aca8961d9ad30 /cmd/podman/commands.go
parent962850c6e0dfcee926af31fc0ad24f1f6c26f8ac (diff)
downloadpodman-25a3923b61a5ca014318e6d957f68abd03947297.tar.gz
podman-25a3923b61a5ca014318e6d957f68abd03947297.tar.bz2
podman-25a3923b61a5ca014318e6d957f68abd03947297.zip
Migrate to cobra CLI
We intend to migrate to the cobra cli from urfave/cli because the project is more well maintained. There are also some technical reasons as well which extend into our remote client work. Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman/commands.go')
-rw-r--r--cmd/podman/commands.go225
1 files changed, 90 insertions, 135 deletions
diff --git a/cmd/podman/commands.go b/cmd/podman/commands.go
index 57126da4a..e1eba1f31 100644
--- a/cmd/podman/commands.go
+++ b/cmd/podman/commands.go
@@ -2,151 +2,106 @@
package main
-import "github.com/urfave/cli"
+import (
+ "github.com/spf13/cobra"
+)
-func getAppCommands() []cli.Command {
- return []cli.Command{
- attachCommand,
- commitCommand,
- buildCommand,
- createCommand,
- diffCommand,
- execCommand,
- killCommand,
- kubeCommand,
- loadCommand,
- loginCommand,
- logoutCommand,
- logsCommand,
- mountCommand,
- pauseCommand,
- psCommand,
- podCommand,
- portCommand,
- pushCommand,
- playCommand,
- restartCommand,
- rmCommand,
- runCommand,
- saveCommand,
- searchCommand,
- startCommand,
- statsCommand,
- stopCommand,
- topCommand,
- umountCommand,
- unpauseCommand,
- volumeCommand,
- waitCommand,
+func getImageSubCommands() []*cobra.Command {
+ return []*cobra.Command{
+ _buildCommand,
+ _importCommand,
+ _loadCommand,
+ _pullCommand,
+ _rmiCommand,
+ _saveCommand,
+ _signCommand,
}
}
-func getImageSubCommands() []cli.Command {
- return []cli.Command{
- buildCommand,
- importCommand,
- loadCommand,
- pullCommand,
- saveCommand,
- trustCommand,
- signCommand,
+func getContainerSubCommands() []*cobra.Command {
+ return []*cobra.Command{
+ _attachCommand,
+ _checkpointCommand,
+ _cleanupCommand,
+ _containerExistsCommand,
+ _commitCommand,
+ _createCommand,
+ _diffCommand,
+ _execCommand,
+ _exportCommand,
+ _killCommand,
+ _logsCommand,
+ _psCommand,
+ _mountCommand,
+ _pauseCommand,
+ _portCommand,
+ _pruneContainersCommand,
+ _refreshCommand,
+ _restartCommand,
+ _restoreCommand,
+ _rmCommand,
+ _runCommmand,
+ _runlabelCommand,
+ _startCommand,
+ _statsCommand,
+ _stopCommand,
+ _topCommand,
+ _umountCommand,
+ _unpauseCommand,
+ _waitCommand,
}
}
-func getSystemSubCommands() []cli.Command {
- return []cli.Command{infoCommand}
+func getPodSubCommands() []*cobra.Command {
+ return []*cobra.Command{
+ _podCreateCommand,
+ _podExistsCommand,
+ _podInspectCommand,
+ _podKillCommand,
+ _podPauseCommand,
+ _podPsCommand,
+ _podRestartCommand,
+ _podRmCommand,
+ _podStartCommand,
+ _podStatsCommand,
+ _podStopCommand,
+ _podTopCommand,
+ _podUnpauseCommand,
+ }
+}
+
+func getVolumeSubCommands() []*cobra.Command {
+ return []*cobra.Command{
+ _volumeCreateCommand,
+ _volumeLsCommand,
+ _volumeRmCommand,
+ _volumeInspectCommand,
+ _volumePruneCommand,
+ }
}
-func getContainerSubCommands() []cli.Command {
- return []cli.Command{
- attachCommand,
- checkpointCommand,
- cleanupCommand,
- containerExistsCommand,
- commitCommand,
- createCommand,
- diffCommand,
- execCommand,
- exportCommand,
- killCommand,
- logsCommand,
- psCommand,
- mountCommand,
- pauseCommand,
- portCommand,
- pruneContainersCommand,
- refreshCommand,
- restartCommand,
- restoreCommand,
- rmCommand,
- runCommand,
- runlabelCommand,
- startCommand,
- statsCommand,
- stopCommand,
- topCommand,
- umountCommand,
- unpauseCommand,
- // updateCommand,
- waitCommand,
+func getGenerateSubCommands() []*cobra.Command {
+ return []*cobra.Command{
+ _containerKubeCommand,
}
}
-func getMainAppFlags() []cli.Flag {
- return []cli.Flag{
- cli.StringFlag{
- Name: "cgroup-manager",
- Usage: "Cgroup manager to use (cgroupfs or systemd, default systemd)",
- },
- cli.StringFlag{
- Name: "cni-config-dir",
- Usage: "Path of the configuration directory for CNI networks",
- },
- cli.StringFlag{
- Name: "conmon",
- Usage: "Path of the conmon binary",
- },
- cli.StringFlag{
- Name: "default-mounts-file",
- Usage: "Path to default mounts file",
- Hidden: true,
- },
- cli.StringSliceFlag{
- Name: "hooks-dir",
- Usage: "Set the OCI hooks directory path (may be set multiple times)",
- },
- cli.IntFlag{
- Name: "max-workers",
- Usage: "The maximum number of workers for parallel operations",
- Hidden: true,
- },
- cli.StringFlag{
- Name: "namespace",
- Usage: "Set the libpod namespace, used to create separate views of the containers and pods on the system",
- Value: "",
- },
- cli.StringFlag{
- Name: "root",
- Usage: "Path to the root directory in which data, including images, is stored",
- },
- cli.StringFlag{
- Name: "runroot",
- Usage: "Path to the 'run directory' where all state information is stored",
- },
- cli.StringFlag{
- Name: "runtime",
- Usage: "Path to the OCI-compatible binary used to run containers, default is /usr/bin/runc",
- },
- cli.StringFlag{
- Name: "storage-driver, s",
- Usage: "Select which storage driver is used to manage storage of images and containers (default is overlay)",
- },
- cli.StringSliceFlag{
- Name: "storage-opt",
- Usage: "Used to pass an option to the storage driver",
- },
- cli.BoolFlag{
- Name: "syslog",
- Usage: "Output logging information to syslog as well as the console",
- },
+
+func getPlaySubCommands() []*cobra.Command {
+ return []*cobra.Command{
+ _playKubeCommand,
+ }
+}
+
+func getTrustSubCommands() []*cobra.Command {
+ return []*cobra.Command{
+ _setTrustCommand,
+ _showTrustCommand,
+ }
+}
+
+func getSystemSubCommands() []*cobra.Command {
+ return []*cobra.Command{
+ _infoCommand,
+ _pruneSystemCommand,
}
}