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

shell completion: kubectl-argo-rollouts get rollout TAB does not auto completes the rollout names #2015

Closed
thomas-riccardi opened this issue May 3, 2022 · 2 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers hacktoberfest
Milestone

Comments

@thomas-riccardi
Copy link
Contributor

Summary

I'm following the getting started guide on linux with auto completion on bash (https://argoproj.github.io/argo-rollouts/getting-started/).

When I hit TAB after kubectl-argo-rollouts get rollout, it does not auto completes the rollout names as I would expect. (for example kubectl get pod TAB does auto completes with existing pod names.)

It would be really useful for discovery of what's inside the cluster.

Diagnostics

What version of Argo Rollouts are you running?

v1.2.0 server and kubectl plugin, on linux, bash.


Message from the maintainers:

Impacted by this bug? Give it a 👍. We prioritize the issues with the most 👍.

@thomas-riccardi thomas-riccardi added the bug Something isn't working label May 3, 2022
@perenesenko perenesenko added this to the v1.3 milestone May 12, 2022
@perenesenko perenesenko added the good first issue Good for newcomers label May 12, 2022
@zachaller
Copy link
Collaborator

I will take this

@zachaller zachaller modified the milestones: v1.3, v1.4 Oct 4, 2022
thomas-riccardi added a commit to thomas-riccardi/argo-rollouts that referenced this issue Oct 27, 2022
…ut [TAB]'

works toward argoproj#2015

use ValidArgsFunction from cobra to list candidates for completion: https://github.com/spf13/cobra/blob/main/shell_completions.md#dynamic-completion-of-nouns
- filtering on 'toComplete' doesn't seem necessary, at least on
  bash (most probably bash-completion handles that itself), not sure
  for the others; I could not find cobra documentation about that

use v2 of GenBashCompletion from cobra: https://github.com/spf13/cobra/blob/main/shell_completions.md#bash-completion-v2
- I chose to disable descriptions for completion (as a bash user I'm not
  used to that), but it's enabled for fish it seems, we can enable it
  if desired, I have no strong opinion on it
@thomas-riccardi
Copy link
Contributor Author

I've started working on it in #2379, with several questions there

thomas-riccardi added a commit to thomas-riccardi/argo-rollouts that referenced this issue Oct 27, 2022
…ut [TAB]'

works toward argoproj#2015

use ValidArgsFunction from cobra to list candidates for completion: https://github.com/spf13/cobra/blob/main/shell_completions.md#dynamic-completion-of-nouns

use v2 of GenBashCompletion from cobra: https://github.com/spf13/cobra/blob/main/shell_completions.md#bash-completion-v2
- I chose to disable descriptions for completion (as a bash user I'm not
  used to that), but it's enabled for fish it seems, we can enable it
  if desired, I have no strong opinion on it
thomas-riccardi added a commit to thomas-riccardi/argo-rollouts that referenced this issue Oct 27, 2022
…TAB]'

works toward argoproj#2015

use ValidArgsFunction from cobra to list candidates for completion: https://github.com/spf13/cobra/blob/main/shell_completions.md#dynamic-completion-of-nouns

use v2 of GenBashCompletion from cobra: https://github.com/spf13/cobra/blob/main/shell_completions.md#bash-completion-v2
- I chose to disable descriptions for completion (as a bash user I'm not
  used to that), but it's enabled for fish it seems, we can enable it
  if desired, I have no strong opinion on it
thomas-riccardi added a commit to thomas-riccardi/argo-rollouts that referenced this issue Oct 27, 2022
…TAB]'

works toward argoproj#2015

use ValidArgsFunction from cobra to list candidates for completion: https://github.com/spf13/cobra/blob/main/shell_completions.md#dynamic-completion-of-nouns

use v2 of GenBashCompletion from cobra: https://github.com/spf13/cobra/blob/main/shell_completions.md#bash-completion-v2
- I chose to disable descriptions for completion (as a bash user I'm not
  used to that), but it's enabled for fish it seems, we can enable it
  if desired, I have no strong opinion on it

Signed-off-by: Thomas Riccardi <[email protected]>
thomas-riccardi added a commit to thomas-riccardi/argo-rollouts that referenced this issue Oct 31, 2022
…TAB]'

works toward argoproj#2015

use ValidArgsFunction from cobra to list candidates for completion: https://github.com/spf13/cobra/blob/main/shell_completions.md#dynamic-completion-of-nouns

use v2 of GenBashCompletion from cobra: https://github.com/spf13/cobra/blob/main/shell_completions.md#bash-completion-v2
- I chose to disable descriptions for completion (as a bash user I'm not
  used to that), but it's enabled for fish it seems, we can enable it
  if desired, I have no strong opinion on it

Signed-off-by: Thomas Riccardi <[email protected]>
zachaller pushed a commit that referenced this issue Nov 8, 2022
…s, experiments, analysisrun) (#2379)

* PoC dynamic shell completion for 'kubectl-argo-rollouts get rollout [TAB]'

works toward #2015

use ValidArgsFunction from cobra to list candidates for completion: https://github.com/spf13/cobra/blob/main/shell_completions.md#dynamic-completion-of-nouns

use v2 of GenBashCompletion from cobra: https://github.com/spf13/cobra/blob/main/shell_completions.md#bash-completion-v2
- I chose to disable descriptions for completion (as a bash user I'm not
  used to that), but it's enabled for fish it seems, we can enable it
  if desired, I have no strong opinion on it

Signed-off-by: Thomas Riccardi <[email protected]>

* Factorize resource names completion functions in new util/completion

Signed-off-by: Thomas Riccardi <[email protected]>

* Add dynamic auto-completion to all ROLLOUT_NAME locations in CLI

...accoding to the Cobra auto-generated CLI documentation.

Signed-off-by: Thomas Riccardi <[email protected]>

* Add dynamic auto-completion to all EXPERIMENT_NAME locations in CLI

...accoding to the Cobra auto-generated CLI documentation.

Signed-off-by: Thomas Riccardi <[email protected]>

* Add dynamic auto-completion to all ANALYSISRUN_NAME locations in CLI

...accoding to the Cobra auto-generated CLI documentation.

Signed-off-by: Thomas Riccardi <[email protected]>

* WIP unit-test dynamic completion

Signed-off-by: Thomas Riccardi <[email protected]>

* Add unit-tests for new completion package

- inspired from kubectl own completion package tests
- fake cmd to avoid circular import
- reuse info/testdata but we could build our own data for more
  isolated tests if needed
- test all 3 types (Rollout, Experiment, AnalysisRun)
- test both first argument completion and second argument

Signed-off-by: Thomas Riccardi <[email protected]>

* Revert "WIP unit-test dynamic completion"

Like in kubectl own completion tests, we now have an independent
'completion' package with its own tests. Stop testing in cmd/ callers
packages.

This reverts commit 75eb5ae.

Signed-off-by: Thomas Riccardi <[email protected]>

Signed-off-by: Thomas Riccardi <[email protected]>
jandersen-plaid pushed a commit to jandersen-plaid/argo-rollouts that referenced this issue Nov 8, 2022
…s, experiments, analysisrun) (argoproj#2379)

* PoC dynamic shell completion for 'kubectl-argo-rollouts get rollout [TAB]'

works toward argoproj#2015

use ValidArgsFunction from cobra to list candidates for completion: https://github.com/spf13/cobra/blob/main/shell_completions.md#dynamic-completion-of-nouns

use v2 of GenBashCompletion from cobra: https://github.com/spf13/cobra/blob/main/shell_completions.md#bash-completion-v2
- I chose to disable descriptions for completion (as a bash user I'm not
  used to that), but it's enabled for fish it seems, we can enable it
  if desired, I have no strong opinion on it

Signed-off-by: Thomas Riccardi <[email protected]>

* Factorize resource names completion functions in new util/completion

Signed-off-by: Thomas Riccardi <[email protected]>

* Add dynamic auto-completion to all ROLLOUT_NAME locations in CLI

...accoding to the Cobra auto-generated CLI documentation.

Signed-off-by: Thomas Riccardi <[email protected]>

* Add dynamic auto-completion to all EXPERIMENT_NAME locations in CLI

...accoding to the Cobra auto-generated CLI documentation.

Signed-off-by: Thomas Riccardi <[email protected]>

* Add dynamic auto-completion to all ANALYSISRUN_NAME locations in CLI

...accoding to the Cobra auto-generated CLI documentation.

Signed-off-by: Thomas Riccardi <[email protected]>

* WIP unit-test dynamic completion

Signed-off-by: Thomas Riccardi <[email protected]>

* Add unit-tests for new completion package

- inspired from kubectl own completion package tests
- fake cmd to avoid circular import
- reuse info/testdata but we could build our own data for more
  isolated tests if needed
- test all 3 types (Rollout, Experiment, AnalysisRun)
- test both first argument completion and second argument

Signed-off-by: Thomas Riccardi <[email protected]>

* Revert "WIP unit-test dynamic completion"

Like in kubectl own completion tests, we now have an independent
'completion' package with its own tests. Stop testing in cmd/ callers
packages.

This reverts commit 75eb5ae.

Signed-off-by: Thomas Riccardi <[email protected]>

Signed-off-by: Thomas Riccardi <[email protected]>
jandersen-plaid pushed a commit to jandersen-plaid/argo-rollouts that referenced this issue Nov 26, 2022
…s, experiments, analysisrun) (argoproj#2379)

* PoC dynamic shell completion for 'kubectl-argo-rollouts get rollout [TAB]'

works toward argoproj#2015

use ValidArgsFunction from cobra to list candidates for completion: https://github.com/spf13/cobra/blob/main/shell_completions.md#dynamic-completion-of-nouns

use v2 of GenBashCompletion from cobra: https://github.com/spf13/cobra/blob/main/shell_completions.md#bash-completion-v2
- I chose to disable descriptions for completion (as a bash user I'm not
  used to that), but it's enabled for fish it seems, we can enable it
  if desired, I have no strong opinion on it

Signed-off-by: Thomas Riccardi <[email protected]>

* Factorize resource names completion functions in new util/completion

Signed-off-by: Thomas Riccardi <[email protected]>

* Add dynamic auto-completion to all ROLLOUT_NAME locations in CLI

...accoding to the Cobra auto-generated CLI documentation.

Signed-off-by: Thomas Riccardi <[email protected]>

* Add dynamic auto-completion to all EXPERIMENT_NAME locations in CLI

...accoding to the Cobra auto-generated CLI documentation.

Signed-off-by: Thomas Riccardi <[email protected]>

* Add dynamic auto-completion to all ANALYSISRUN_NAME locations in CLI

...accoding to the Cobra auto-generated CLI documentation.

Signed-off-by: Thomas Riccardi <[email protected]>

* WIP unit-test dynamic completion

Signed-off-by: Thomas Riccardi <[email protected]>

* Add unit-tests for new completion package

- inspired from kubectl own completion package tests
- fake cmd to avoid circular import
- reuse info/testdata but we could build our own data for more
  isolated tests if needed
- test all 3 types (Rollout, Experiment, AnalysisRun)
- test both first argument completion and second argument

Signed-off-by: Thomas Riccardi <[email protected]>

* Revert "WIP unit-test dynamic completion"

Like in kubectl own completion tests, we now have an independent
'completion' package with its own tests. Stop testing in cmd/ callers
packages.

This reverts commit 75eb5ae.

Signed-off-by: Thomas Riccardi <[email protected]>

Signed-off-by: Thomas Riccardi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers hacktoberfest
Projects
None yet
Development

No branches or pull requests

3 participants