Merge pull request #4081 from crosbymichael/info-spec

Add ctr c info --spec flag to output spec
This commit is contained in:
Maksym Pavlenko 2020-03-05 09:54:41 -08:00 committed by GitHub
commit 54fd2cba49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)