kpack-cli
kpack-cli copied to clipboard
Verb subcommands should show help text in absence of argument
Problem
Today when you type a noun subcommand (ex. kp image
), the help text for that command prints by default, but when you add a verb onto that noun subcommand (ex. kp image status
), an error prints.
Example:
Instead of printing an error when an argument is missing, we should print the help text associated with that verb subcommand, as if the user had typed the -h
flag.
We can still print an error (ex. Error: accepts 1 arg(s), received 0
), but we should also print the help text and state WHICH arg is missing.
Example:
Mockup of potential solution:
When a verb subcommand does not have the necessary args, help text and an error message are printed together.
$kp image status
Error: accepts 1 arg(s) - <name>, received 0
`kp image status` prints detailed information about the status of a specific image in the provided namespace.
namespace defaults to the kubernetes current-context namespace.
Usage:
kp image status <name> [flags]
Examples:
kp image status my-image
kp image status my-other-image -n my-namespace
Flags:
-h, --help help for status
-n, --namespace string kubernetes namespace
Alternative solution:
Provide a human readable error message that explains why the error happened and what you can do about it. For example:
$ kubectl describe
error: You must specify the type of resource to describe. Use "kubectl api-resources" for a complete list of supported resources.