summaryrefslogtreecommitdiff
path: root/cmd/podman/container.go
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2019-03-12 15:59:45 -0600
committerEd Santiago <santiago@redhat.com>2019-03-13 08:29:52 -0600
commit3de5e4a99fe441e41e1a1c9f90e8bb6e0ff1bd28 (patch)
treeafa2bf8430691a5e1ae502a17825ccb73ab6e142 /cmd/podman/container.go
parent8b3f759800ebd6e53e0a807728ede633aa9bdb36 (diff)
downloadpodman-3de5e4a99fe441e41e1a1c9f90e8bb6e0ff1bd28.tar.gz
podman-3de5e4a99fe441e41e1a1c9f90e8bb6e0ff1bd28.tar.bz2
podman-3de5e4a99fe441e41e1a1c9f90e8bb6e0ff1bd28.zip
Usability cleanup for 'inspect'
Make the usage messages (and options) different between podman inspect, podman image inspect, and podman container inspect. Disable inapplicable options (-l, -s) for podman image inspect Disable -t (type) when the type is implicit through the subcommand. Update man page to reflect differences in usage. Fix broken test. Uglier than desirable due to Go and Cobra limitations Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'cmd/podman/container.go')
-rw-r--r--cmd/podman/container.go19
1 files changed, 18 insertions, 1 deletions
diff --git a/cmd/podman/container.go b/cmd/podman/container.go
index 8ad8d7a44..ce6ad8883 100644
--- a/cmd/podman/container.go
+++ b/cmd/podman/container.go
@@ -19,6 +19,20 @@ var (
},
}
+ contInspectSubCommand cliconfig.InspectValues
+ _contInspectSubCommand = &cobra.Command{
+ Use: strings.Replace(_inspectCommand.Use, "| IMAGE", "", 1),
+ Short: "Display the configuration of a container",
+ Long: `Displays the low-level information on a container identified by name or ID.`,
+ RunE: func(cmd *cobra.Command, args []string) error {
+ contInspectSubCommand.InputArgs = args
+ contInspectSubCommand.GlobalFlags = MainGlobalOpts
+ return inspectCmd(&contInspectSubCommand)
+ },
+ Example: `podman container inspect myCtr
+ podman container inspect -l --format '{{.Id}} {{.Config.Labels}}'`,
+ }
+
listSubCommand cliconfig.PsValues
_listSubCommand = &cobra.Command{
Use: strings.Replace(_psCommand.Use, "ps", "list", 1),
@@ -37,12 +51,15 @@ var (
// Commands that are universally implemented.
containerCommands = []*cobra.Command{
_containerExistsCommand,
- _inspectCommand,
+ _contInspectSubCommand,
_listSubCommand,
}
)
func init() {
+ contInspectSubCommand.Command = _contInspectSubCommand
+ inspectInit(&contInspectSubCommand)
+
listSubCommand.Command = _listSubCommand
psInit(&listSubCommand)