Skip to content

Missing subcommand disable flags parsing #2311

@zoriya

Description

@zoriya

When a subcommand is required but not provided, it outputs an error (expected). Example:

$ kubectl create svc
Create a service using a specified subcommand.
Aliases:
service, svc
Available Commands:
  clusterip      Create a ClusterIP service
  externalname   Create an ExternalName service
  loadbalancer   Create a LoadBalancer service
  nodeport       Create a NodePort service
Usage:
  kubectl create service [flags] [options]
Use "kubectl create service <command> --help" for more information about a given command.
Use "kubectl options" for a list of global command-line options (applies to all commands).

But when we have (valid) flags already specified we get a unknown flag error:

$ kubectl create -o yaml svc
error: unknown shorthand flag: 'o' in -o
See 'kubectl create service --help' for usage.

I would expect the -o yaml flag (specified by the create subcommand) to be silently accepted and get back the error/help output we get with kubectl create svc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions