mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 18:54:06 +00:00
warn if kubectl create with extra argument
This commit is contained in:
parent
0d22ddc802
commit
d51fbd35ce
@ -278,8 +278,8 @@ func createAndRefresh(info *resource.Info) error {
|
||||
|
||||
// NameFromCommandArgs is a utility function for commands that assume the first argument is a resource name
|
||||
func NameFromCommandArgs(cmd *cobra.Command, args []string) (string, error) {
|
||||
if len(args) == 0 {
|
||||
return "", cmdutil.UsageErrorf(cmd, "NAME is required")
|
||||
if len(args) != 1 {
|
||||
return "", cmdutil.UsageErrorf(cmd, "exactly one NAME is required, got %d", len(args))
|
||||
}
|
||||
return args[0], nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user