mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 02:09:56 +00:00
Fix panic when the namespace flag is not present
This commit is contained in:
parent
952e8302fb
commit
f79998a9b1
@ -235,13 +235,15 @@ Find more information at https://github.com/kubernetes/kubernetes.`,
|
|||||||
cmds.AddCommand(NewCmdExplain(f, out))
|
cmds.AddCommand(NewCmdExplain(f, out))
|
||||||
cmds.AddCommand(NewCmdConvert(f, out))
|
cmds.AddCommand(NewCmdConvert(f, out))
|
||||||
|
|
||||||
if cmds.Flag("namespace").Annotations == nil {
|
if cmds.Flag("namespace") != nil {
|
||||||
cmds.Flag("namespace").Annotations = map[string][]string{}
|
if cmds.Flag("namespace").Annotations == nil {
|
||||||
|
cmds.Flag("namespace").Annotations = map[string][]string{}
|
||||||
|
}
|
||||||
|
cmds.Flag("namespace").Annotations[cobra.BashCompCustom] = append(
|
||||||
|
cmds.Flag("namespace").Annotations[cobra.BashCompCustom],
|
||||||
|
"__kubectl_get_namespaces",
|
||||||
|
)
|
||||||
}
|
}
|
||||||
cmds.Flag("namespace").Annotations[cobra.BashCompCustom] = append(
|
|
||||||
cmds.Flag("namespace").Annotations[cobra.BashCompCustom],
|
|
||||||
"__kubectl_get_namespaces",
|
|
||||||
)
|
|
||||||
|
|
||||||
return cmds
|
return cmds
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user