add OutputsRawFormat helper; default show-all on multiple resource kinds

This commit is contained in:
juanvallejo
2017-01-16 13:58:55 -05:00
parent cade00e646
commit 430283b973
2 changed files with 20 additions and 3 deletions

View File

@@ -729,3 +729,19 @@ func RequireNoArguments(c *cobra.Command, args []string) {
CheckErr(UsageError(c, fmt.Sprintf(`unknown command %q`, strings.Join(args, " "))))
}
}
// OutputsRawFormat determines if a command's output format is machine parsable
// or returns false if it is human readable (name, wide, etc.)
func OutputsRawFormat(cmd *cobra.Command) bool {
output := GetFlagString(cmd, "output")
if output == "json" ||
output == "yaml" ||
output == "go-template" ||
output == "go-template-file" ||
output == "jsonpath" ||
output == "jsonpath-file" {
return true
}
return false
}