Skip to content

feat(comp): Dynamic completion of charts - #6730

Merged
mattfarina merged 1 commit into
helm:masterfrom
VilledeMontreal:feat/dynCompChart
Oct 22, 2019
Merged

mattfarina merged 1 commit into
helm:masterfrom
VilledeMontreal:feat/dynCompChart

Conversation

@marckhouzam

Copy link
Copy Markdown
Member

Now targeted for the master branch, in replacement of #6706.

What this PR does / why we need it:

This PR enables dynamic shell completion for charts. This includes chart references, local charts, and URLs.

  1. Chart references are completed using helm search repo <specified repo> to look for possible choices.
  2. Local charts are completed using shell file completion.
  3. URLs only have their prefix completed (see example).

The following commands are supported:

helm show <subcmd> <TAB>      - completes to chart (ref, path, url)
helm pull <TAB>               - completes to chart (ref, url)

helm install [NAME] <TAB>     - completes to chart (ref, path, url)
helm template [NAME] <TAB>    - completes to chart (ref, path, url)
helm upgrade <TAB>            - completes to release name
helm upgrade <release> <TAB>  - completes to chart (ref, path, url)

Of note is the handling the case where no prefix is specified for completion of charts as shown in the first example below.

Example 1:

> helm install name <TAB>
# provides the choices (based on my configured repos)
./      /     astronomer/   file://     gitlab/     http://    https://     stable/

In the above example:

  1. ./ and / are shown as a hint to the user that charts on the file system can be specified
  2. astronomer/, gitlab/ and stable/ are repos currently configured
  3. file://, http:// and https:// are the URL prefixes a user can use

Example 2:

> helm install name sta<TAB>
# uses helm repo list to complete to:
> helm install name stable/

> helm install name stable/nginx-<TAB>
# uses helm search to complete to:
stable/nginx-ingress         stable/nginx-ldapauth-proxy  stable/nginx-lego

Special notes for your reviewer:

This PR has been tested for backwards compatibility using the acceptance-testing repo.

New tests have been prepared in helm/acceptance-testing#56

helm show <subcmd> <TAB>      - completes to chart (ref, path, url)
helm pull <TAB>               - completes to chart (ref, url)

helm install [NAME] <TAB>     - completes to chart (ref, path, url)
helm template [NAME] <TAB>    - completes to chart (ref, path, url)
helm upgrade <TAB>            - completes to release name
helm upgrade <release> <TAB>  - completes to chart (ref, path, url)

Signed-off-by: Marc Khouzam <[email protected]>
@helm-bot helm-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 21, 2019
@bacongobbler bacongobbler added feature v3.x Issues and Pull Requests related to the major version v3 labels Oct 21, 2019
@bacongobbler bacongobbler modified the milestones: 3.0.0, 3.0.0-beta.5 Oct 21, 2019
@marckhouzam

Copy link
Copy Markdown
Member Author

Thanks for merging!

One question: helm search repo is dramatically slower than helm search hub. Is this normal? (I haven't looked at the code). The completion would be more user friendly if helm search repo was as fast as helm search hub I believe @mattfarina worked on the hub part?

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

Labels

feature size/L Denotes a PR that changes 100-499 lines, ignoring generated files. v3.x Issues and Pull Requests related to the major version v3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants