Usage:"Return JSON for specified type, (e.g image, container or task)",
},
cli.StringFlag{
Name:"format, f",
Value:defaultFormat,
Usage:"Format the output using the given go template",
},
cli.BoolFlag{
Name:"size",
Usage:"Display total file size if the type is container",
},
}
inspectDescription="This displays the low-level information on containers and images identified by name or ID. By default, this will render all results in a JSON array. If the container and image have the same name, this will return container JSON for unspecified type."
inspectCommand=cli.Command{
Name:"inspect",
Usage:"Displays the configuration of a container or image",
Description:inspectDescription,
Flags:inspectFlags,
Action:inspectCmd,
ArgsUsage:"CONTAINER-OR-IMAGE",
}
)
funcinspectCmd(c*cli.Context)error{
args:=c.Args()
iflen(args)==0{
returnerrors.Errorf("container or image name must be specified: kpod inspect [options [...]] name")
}
iflen(args)>1{
returnerrors.Errorf("too many arguments specified")
}
itemType:=c.String("type")
size:=c.Bool("size")
format:=defaultFormat
ifc.String("format")!=""{
format=c.String("format")
}
switchitemType{
caseinspectTypeContainer:
caseinspectTypeImage:
caseinspectAll:
default:
returnerrors.Errorf("the only recognized types are %q, %q, and %q",inspectTypeContainer,inspectTypeImage,inspectAll)