Skip to content

feat(cmd): Subcommands for the completion command - #8314

Merged
bacongobbler merged 1 commit into
helm:masterfrom
VilledeMontreal:feat/completionSubcommands
Jul 7, 2020
Merged

bacongobbler merged 1 commit into
helm:masterfrom
VilledeMontreal:feat/completionSubcommands

Conversation

@marckhouzam

Copy link
Copy Markdown
Member

What this PR does / why we need it:

Fixes #8313.

This PR converts the bash and zsh arguments of the completion command to sub-commands.

Making each shell a subcommand of the completion command has multiple advantages:

  • simplifies the code,
  • allows to have different flags for each shell,
    for example, a future --no-descriptions flag for fish only,
  • allows to tailor the help text per shell,
  • allows Cobra to handle error cases (specifying an invalid shell).

Special notes for your reviewer:

This should be done before #8111 is released to users, or else it would technically become a breaking change. This is because #8111 will add a new --no-descriptions flag to the completion command, and without this PR, we cannot restrict it to the fish shell.

The PR also improves on the help text for each shell.

If applicable:

  • this PR has been tested for backwards compatibility using the completion tests of the acceptance-testing repo

Making each shell a subcommand of the 'completion' has multiple
advantages:
- simplifies the code,
- allows to have different flags for each shell,
  for example, a future `--no-descriptions` flag for fish only,
- allows to tailor the help text per shell.

Signed-off-by: Marc Khouzam <[email protected]>
@helm-bot helm-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 15, 2020
@marckhouzam
marckhouzam requested a review from technosophos June 15, 2020 12:11
@marckhouzam

Copy link
Copy Markdown
Member Author

For the sake of transparency, my plan is that the proposed --no-descriptions flag eventually be applicable to all shells. But that may take a while. So I like that this PR allows to control flags on a per-shell basis.

@marckhouzam marckhouzam added this to the 3.4.0 milestone Jun 18, 2020
@marckhouzam

Copy link
Copy Markdown
Member Author

If release 3.3 still has some room (time-wise), I wouldn't mind a review on this small change to unblock #8111 which brings support for Fish completion.

@bacongobbler bacongobbler left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code LGTM. Given that 3.3.0-rc.1 is about to be released, I'll go ahead and merge this one in. Thanks @marckhouzam!

@bacongobbler bacongobbler modified the milestones: 3.4.0, 3.3.0 Jul 7, 2020
@bacongobbler
bacongobbler merged commit 1eebcf3 into helm:master Jul 7, 2020
@marckhouzam
marckhouzam deleted the feat/completionSubcommands branch July 7, 2020 16:03
@marckhouzam

Copy link
Copy Markdown
Member Author

Thanks for getting this into 3.3 @bacongobbler!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

completion command applies flags to every shell

3 participants