suggest use of kube explain <resource>
in kube get output
This patch improves usability flow, making it easier for a user to discover the command `kube explain <resource>` through `kube get` output.
This commit is contained in:
@@ -287,7 +287,7 @@ Find more information at https://github.com/kubernetes/kubernetes.`,
|
|||||||
NewCmdDescribe(f, out, err),
|
NewCmdDescribe(f, out, err),
|
||||||
NewCmdLogs(f, out),
|
NewCmdLogs(f, out),
|
||||||
NewCmdAttach(f, in, out, err),
|
NewCmdAttach(f, in, out, err),
|
||||||
NewCmdExec("kubectl", f, in, out, err),
|
NewCmdExec(cmds.Root().CommandPath(), f, in, out, err),
|
||||||
NewCmdPortForward(f, out, err),
|
NewCmdPortForward(f, out, err),
|
||||||
NewCmdProxy(f, out),
|
NewCmdProxy(f, out),
|
||||||
},
|
},
|
||||||
|
@@ -171,7 +171,14 @@ func RunGet(f *cmdutil.Factory, out io.Writer, errOut io.Writer, cmd *cobra.Comm
|
|||||||
|
|
||||||
if len(args) == 0 && cmdutil.IsFilenameEmpty(options.Filenames) {
|
if len(args) == 0 && cmdutil.IsFilenameEmpty(options.Filenames) {
|
||||||
fmt.Fprint(errOut, "You must specify the type of resource to get. ", valid_resources)
|
fmt.Fprint(errOut, "You must specify the type of resource to get. ", valid_resources)
|
||||||
return cmdutil.UsageError(cmd, "Required resource not specified.")
|
|
||||||
|
fullCmdName := cmd.Parent().CommandPath()
|
||||||
|
usageString := "Required resource not specified."
|
||||||
|
if len(fullCmdName) > 0 && cmdutil.IsCommandExists(cmd, "explain") {
|
||||||
|
usageString = fmt.Sprintf("%s\nUse \"%s explain <resource>\" for a detailed description of that resource (e.g. %[2]s explain pods).", usageString, fullCmdName)
|
||||||
|
}
|
||||||
|
|
||||||
|
return cmdutil.UsageError(cmd, usageString)
|
||||||
}
|
}
|
||||||
|
|
||||||
// determine if args contains "all"
|
// determine if args contains "all"
|
||||||
|
Reference in New Issue
Block a user