mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 07:57:35 +00:00
Merge pull request #39042 from juanvallejo/jvallejo/dont-filter-pods-if-json-or-yaml
Automatic merge from submit-queue (batch tested with PRs 36467, 36528, 39568, 40094, 39042) do not filter kubectl get pods if -o json or yaml Fixes: https://github.com/kubernetes/kubernetes/issues/38327 This patch sets the value of --show-all to true if the output format specified is 'json' or 'yaml'. **Release note**: ```release-note release-note-none ``` @smarterclayton
This commit is contained in:
@@ -733,3 +733,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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user