Skip to content

Commit

Permalink
default --nested to yaml output (#1214)
Browse files Browse the repository at this point in the history
  • Loading branch information
theganyo authored Jul 17, 2023
1 parent 1c8a972 commit 5c4748c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cmd/registry/cmd/get/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ func Command() *cobra.Command {
if err != nil {
return err
}

// default output
if output == "" {
if nested {
output = "yaml"
} else {
output = "name"
}
}

if nested && output != "yaml" {
return errors.New("--nested is only supported for yaml output")
}
Expand Down Expand Up @@ -92,7 +102,7 @@ func Command() *cobra.Command {
}

cmd.Flags().StringVar(&filter, "filter", "", "filter selected resources")
cmd.Flags().StringVarP(&output, "output", "o", "name", "output type (name|yaml|contents)")
cmd.Flags().StringVarP(&output, "output", "o", "", "output type (name|yaml|contents)")
cmd.Flags().BoolVar(&nested, "nested", false, "include nested subresources in YAML output")
return cmd
}
Expand Down

0 comments on commit 5c4748c

Please sign in to comment.