Repository navigation
Dynamic completion for subcommands that apply to releases - #5562
bacongobbler merged 10 commits into
Conversation
Signed-off-by: Marc Khouzam <[email protected]>
Signed-off-by: Marc Khouzam <[email protected]>
Signed-off-by: Marc Khouzam <[email protected]>
Flags sometimes can be used with an = sign, such as --kube-context=prod.
In this case, the variable ${flagname} retains the = sign as part of the
flag name. However, in zsh completion, an = sign cannot be part of an
index of the associative array 'flaghash' or else it causes an error.
This commits strips the = sign out when using ${flagname} as an index.
Note that this is not a big deal since flaghash is not actually used
anywhere in Helm completion. I believe it is made available by the
Cobra framework in case some completions choose to use it.
Signed-off-by: Marc Khouzam <[email protected]>
Signed-off-by: Marc Khouzam <[email protected]>
technosophos
left a comment
There was a problem hiding this comment.
LGTM. And a huge thanks for fixing that all up!
|
Also, if you'd like to file a second PR against the dev-v3 branch, we'll make sure to get this into Helm 3 as well. You can CC me on that PR |
|
Sorry for the delay, somehow I never got the notification you had replied! |
|
@technosophos I was thinking that when doing completion, the list of possible releases should be obtained using 'helm list -a'. Currently this PR does not use the -a' flag. Unless you disagree I will update the PR to use the -a' flag. |
Signed-off-by: Marc Khouzam <[email protected]>
|
Ok, this one is ready for the master branch. I've just added one commit that uses I'm working on a separate PR for dev-v3. One question: is there a way to list release that start with a specified prefix? Such as I'm asking for two reasons |
Signed-off-by: Marc Khouzam <[email protected]>
|
While working on the version for dev-v3, I've realized I had forgotten to include This latest commit does this. |
|
I realized that The real value of this change is when there are more than 256 releases to list. By using the filter, we greatly reduce the chance of the release the user wants being beyond the 256 limit. |
|
I haven't forgotten about adding this to dev-v3. The issue is that dev-v3 needs a newer version of Cobra for things to work properly. I've reached out to the Cobra project to create a new release, which they've agreed to do. Once it is ready, I'll be able to post this feature for dev-v3. |
bacongobbler
left a comment
There was a problem hiding this comment.
LGTM! @marckhouzam do you need to bump cobra to 0.0.4 here as well, or is this good to merge? Let me know :)
This reverts commit d2ab3f5. The reverted commit turned out to be a workaroud another problem. The real fix is submitted in PR helm#5680 Signed-off-by: Marc Khouzam <[email protected]>
3f74a06 to
1bd6281
Compare
|
@bacongobbler Thanks for the review! I just reverted a commit that was part of this PR because I realized it was a hack for which the real fix is in PR #5680 . As for Cobra, the currently used commit is sufficient for this PR. I think moving to 0.0.4 is a good idea as it brings a couple of minor fixes but should be done independently of this PR. If you want to move to 0.0.4, I can make a new PR for it. Just let me know. So, this PR is good to commit. Thanks! |
|
Oh, and the force push was because the revert commit did not have the signed-off-by at the end so the DCO check failed. I amended the commit and forced pushed on my branch. |
|
Awesome! Bumping Cobra would be a good idea to keep Helm 2 and Helm 3 in sync, but if it's not necessary for this PR, we can tackle bumping cobra in a followup PR. Feel free to make a new PR if you'd like :) Thanks for responding so quickly and addressing that commit. This looks good to merge. Thanks so much for following through with this! |
What this PR does / why we need it:
Add dynamic completion after
by fetching the list of releases from the cluster.
Special notes for your reviewer:
This PR puts in the foundation for dynamic completion support in Helm.
It is inspired by the dynamic completion provided by kubectl.
Both bash and zsh are handled.
As dynamic completion actually sends queries to the cluster, this PR handles the use of Helm flags that affect which cluster should be contacted: