Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix kubectl tab-completion and improve error messages #14868

Merged
merged 1 commit into from
Jun 14, 2023

Commits on Jun 14, 2023

  1. Fix kubectl tab-completion and improve error messages

    Try to fix the following issues when `kubectl` is an alias for
    `minikube kubectl --` and tab-completion for `kubectl` is enabled:
    
     1. When `--cluster name` form of command-line option is used, it
        conflicts with argument parsing, `name` is interpreted as plugin name.
        Call to `kubectl --cluster test help` leads to error `Error: flags
        cannot be placed before plugin name: --cluster`. Fix this by using
        `--cluster=name` form, which is correctly handled also in call
        `kubectl --cluster=test help`.
     2. When `--cluster=name` is added as first argument (as seen in original
        code), it still leads to error mentioned above when the command is
        unknown like in the call `kubectl --cluster=test unknown`. Fix this by
        inserting `--cluster=name` after all (sub-)commands and before any
        flags/options.
     3. The original code passed `--cluster=name` to normal `kubectl` calls,
        but omitted it for tab-completion calls. This might lead to wrong tab
        suggestions about pods, deployments and the like. Fix this by always
        adding `--cluster=name` option to the command line.
     4. In case of tab-completion, put the `--cluster=name` immediately after
        `__complete` command to prevent any interference with incomplete
        commands (just in case). This works fine and does not generate any
        errors like mentioned in point 2.
    oldium authored and spowelljr committed Jun 14, 2023
    Configuration menu
    Copy the full SHA
    6d28d2a View commit details
    Browse the repository at this point in the history