mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-08-26 10:17:53 +00:00
A surprisingly big change. A core problem was that `podman inspect` allows for passing containers AND images with the default `--type=all`. This only worked partially as the data was processed in isolation which caused various issues (e.g., two separate outputs instead of one) but it also caused issues regarding error handling. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
36 lines
1.1 KiB
Go
36 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"github.com/containers/libpod/cmd/podman/inspect"
|
|
"github.com/containers/libpod/cmd/podman/registry"
|
|
"github.com/containers/libpod/pkg/domain/entities"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var (
|
|
// Command: podman _inspect_ Object_ID
|
|
inspectCmd = &cobra.Command{
|
|
Use: "inspect [flags] {CONTAINER_ID | IMAGE_ID}",
|
|
Short: "Display the configuration of object denoted by ID",
|
|
Long: "Displays the low-level information on an object identified by name or ID",
|
|
TraverseChildren: true,
|
|
RunE: inspectExec,
|
|
Example: `podman inspect fedora
|
|
podman inspect --type image fedora
|
|
podman inspect CtrID ImgID
|
|
podman inspect --format "imageId: {{.Id}} size: {{.Size}}" fedora`,
|
|
}
|
|
inspectOpts *entities.InspectOptions
|
|
)
|
|
|
|
func init() {
|
|
registry.Commands = append(registry.Commands, registry.CliCommand{
|
|
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
|
Command: inspectCmd,
|
|
})
|
|
inspectOpts = inspect.AddInspectFlagSet(inspectCmd)
|
|
}
|
|
|
|
func inspectExec(cmd *cobra.Command, args []string) error {
|
|
return inspect.Inspect(args, *inspectOpts)
|
|
}
|