From 65033b586fb353734d29dac1dfb9f342d5eeaa21 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Wed, 13 Jun 2018 07:40:41 -0400 Subject: add podman container and image command Signed-off-by: Daniel J Walsh Closes: #941 Approved by: TomSweeneyRedHat --- cmd/podman/container.go | 45 +++++++++++++++++++++++++++++++++++++++++++++ cmd/podman/image.go | 32 ++++++++++++++++++++++++++++++++ cmd/podman/images.go | 9 +++++++++ cmd/podman/main.go | 2 ++ cmd/podman/ps.go | 9 +++++++++ cmd/podman/rmi.go | 9 +++++++++ 6 files changed, 106 insertions(+) create mode 100644 cmd/podman/container.go create mode 100644 cmd/podman/image.go (limited to 'cmd') diff --git a/cmd/podman/container.go b/cmd/podman/container.go new file mode 100644 index 000000000..c8ad8e04d --- /dev/null +++ b/cmd/podman/container.go @@ -0,0 +1,45 @@ +package main + +import ( + "github.com/urfave/cli" +) + +var ( + subCommands = []cli.Command{ + attachCommand, + commitCommand, + createCommand, + diffCommand, + execCommand, + exportCommand, + inspectCommand, + killCommand, + logsCommand, + lsCommand, + mountCommand, + pauseCommand, + portCommand, + // pruneCommand, + restartCommand, + rmCommand, + runCommand, + startCommand, + statsCommand, + stopCommand, + topCommand, + umountCommand, + unpauseCommand, + // updateCommand, + waitCommand, + } + + containerDescription = "Manage containers" + containerCommand = cli.Command{ + Name: "container", + Usage: "container COMMAND", + Description: containerDescription, + ArgsUsage: "", + Subcommands: subCommands, + UseShortOptionHandling: true, + } +) diff --git a/cmd/podman/image.go b/cmd/podman/image.go new file mode 100644 index 000000000..5deea5c74 --- /dev/null +++ b/cmd/podman/image.go @@ -0,0 +1,32 @@ +package main + +import ( + "github.com/urfave/cli" +) + +var ( + imageSubCommands = []cli.Command{ + buildCommand, + historyCommand, + importCommand, + inspectCommand, + loadCommand, + lsImagesCommand, + // pruneCommand, + pullCommand, + pushCommand, + rmImageCommand, + saveCommand, + tagCommand, + } + + imageDescription = "Manage images" + imageCommand = cli.Command{ + Name: "image", + Usage: "image COMMAND", + Description: imageDescription, + ArgsUsage: "", + Subcommands: imageSubCommands, + UseShortOptionHandling: true, + } +) diff --git a/cmd/podman/images.go b/cmd/podman/images.go index 918015937..a54620c72 100644 --- a/cmd/podman/images.go +++ b/cmd/podman/images.go @@ -93,6 +93,15 @@ var ( ArgsUsage: "", UseShortOptionHandling: true, } + lsImagesCommand = cli.Command{ + Name: "ls", + Usage: "list images in local storage", + Description: imagesDescription, + Flags: imagesFlags, + Action: imagesCmd, + ArgsUsage: "", + UseShortOptionHandling: true, + } ) func imagesCmd(c *cli.Context) error { diff --git a/cmd/podman/main.go b/cmd/podman/main.go index 8edecffb3..56e724098 100644 --- a/cmd/podman/main.go +++ b/cmd/podman/main.go @@ -39,12 +39,14 @@ func main() { app.Commands = []cli.Command{ attachCommand, commitCommand, + containerCommand, buildCommand, createCommand, diffCommand, execCommand, exportCommand, historyCommand, + imageCommand, imagesCommand, importCommand, infoCommand, diff --git a/cmd/podman/ps.go b/cmd/podman/ps.go index 4ca9b13a3..ca20f3f33 100644 --- a/cmd/podman/ps.go +++ b/cmd/podman/ps.go @@ -128,6 +128,15 @@ var ( ArgsUsage: "", UseShortOptionHandling: true, } + lsCommand = cli.Command{ + Name: "ls", + Usage: "List containers", + Description: psDescription, + Flags: psFlags, + Action: psCmd, + ArgsUsage: "", + UseShortOptionHandling: true, + } ) func psCmd(c *cli.Context) error { diff --git a/cmd/podman/rmi.go b/cmd/podman/rmi.go index 796ec2a3d..f3e1a8e36 100644 --- a/cmd/podman/rmi.go +++ b/cmd/podman/rmi.go @@ -32,6 +32,15 @@ var ( Flags: rmiFlags, UseShortOptionHandling: true, } + rmImageCommand = cli.Command{ + Name: "rm", + Usage: "removes one or more images from local storage", + Description: rmiDescription, + Action: rmiCmd, + ArgsUsage: "IMAGE-NAME-OR-ID [...]", + Flags: rmiFlags, + UseShortOptionHandling: true, + } ) func rmiCmd(c *cli.Context) error { -- cgit v1.2.3-54-g00ecf