Add ctr c info --spec flag to output spec
This flag makes it easy to view only the OCI spec for the container. Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
ca66f3dd5d
commit
00e6be9f45
@ -248,6 +248,12 @@ var infoCommand = cli.Command{
|
||||
Name: "info",
|
||||
Usage: "get info about a container",
|
||||
ArgsUsage: "CONTAINER",
|
||||
Flags: []cli.Flag{
|
||||
cli.BoolFlag{
|
||||
Name: "spec",
|
||||
Usage: "only display the spec",
|
||||
},
|
||||
},
|
||||
Action: func(context *cli.Context) error {
|
||||
id := context.Args().First()
|
||||
if id == "" {
|
||||
@ -266,6 +272,14 @@ var infoCommand = cli.Command{
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if context.Bool("spec") {
|
||||
v, err := typeurl.UnmarshalAny(info.Spec)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
commands.PrintAsJSON(v)
|
||||
return nil
|
||||
}
|
||||
|
||||
if info.Spec != nil && info.Spec.Value != nil {
|
||||
v, err := typeurl.UnmarshalAny(info.Spec)
|
||||
|
Loading…
Reference in New Issue
Block a user