You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.
Although I have shell completion correctly working with the bash shell, once I install a new plugin, the shell completion does not include the new plugin. Also, when I remove a plugin, the bash shell completion continues to complete the plugin name as if it was still available.
The problem is that tanzu's bash completion uses a static script that hard-code the list of plugins at the time the script is generated. Every time a plugin is added or removed, the script would need to be re-generated and re-sourced by the user.
This does not happen to the other shells (zsh, fish, powershell) because they use a "dynamic" script that requests shell completions from the tanzu CLI itself at the time they are needed by the user.
Affected product area (please put an X in all that apply)
( ) APIs
( ) Addons
(x) CLI
( ) Docs
( ) IAM
( ) Installation
(x) Plugin
( ) Security
( ) Test and Release
(x) User Experience
( ) Developer Experience
Expected behavior
The shell completion should always reflect the current available list of commands/plugins
Steps to reproduce the bug
$ bash
# Delete all plugins
bash-5.1$ tanzu plugin clean
✔ successfully cleaned up all plugins
# Setup shell completion
bash-5.1$ source <(tanzu completion bash)
# Notice that shell completion correctly does not suggest plugins yet
bash-5.1$ tanzu [tab][tab]
completion config context help init plugin update version
bash-5.1$ tanzu plugin install login
ℹ Installing plugin 'login:v0.28.0-dev'
✔ successfully installed 'login' plugin
# Notice shell completion still does not suggest the login plugin even though it should
bash-5.1$ tanzu l[tab][tab]
bash-5.1$ tanzu -h | grep login
login Login to the platform
# I need to source the script again to get the new list of plugins
bash-5.1$ source <(tanzu completion bash)
# Notice that the login plugin is now suggested
bash-5.1$ tanzu [tab][tab]
completion config context help init login plugin update version
# Delete all plugins
bash-5.1$ tanzu plugin clean
✔ successfully cleaned up all plugins
# Notice the login plugin is still suggested when it should not
bash-5.1$ tanzu [tab][tab]
completion config context help init login plugin update version
Version (include the SHA if the version is not obvious)
Fixvmware-tanzu#3963
Cobra's bash completion V2 is the version now maintained by Cobra.
See https://github.com/spf13/cobra/blob/main/shell_completions.md#bash-completion-v2
This new version comes with extra features compared to the original bash
completion logic, such as:
- Supports completion descriptions (like the other shells)
- Small bash completion script (325 lines versus 1342 lines for tanzu)
- Streamlined user experience thanks to a completion behavior aligned
with the other shells (for example, it does not suggest the = form for
flag completion)
This commit also enables completion descriptions for bash which is
available with Cobra's bash completion v2.
Signed-off-by: Marc Khouzam <kmarc@vmware.com>
Fixvmware-tanzu#3963
Cobra's bash completion V2 is the version now maintained by Cobra.
See https://github.com/spf13/cobra/blob/main/shell_completions.md#bash-completion-v2
This new version comes with extra features compared to the original bash
completion logic, such as:
- Supports completion descriptions (like the other shells)
- Small bash completion script (325 lines versus 1342 lines for tanzu)
- Streamlined user experience thanks to a completion behavior aligned
with the other shells (for example, it does not suggest the = form for
flag completion)
This commit also enables completion descriptions for bash which is
available with Cobra's bash completion v2.
Signed-off-by: Marc Khouzam <kmarc@vmware.com>
Fix#3963
Cobra's bash completion V2 is the version now maintained by Cobra.
See https://github.com/spf13/cobra/blob/main/shell_completions.md#bash-completion-v2
This new version comes with extra features compared to the original bash
completion logic, such as:
- Supports completion descriptions (like the other shells)
- Small bash completion script (325 lines versus 1342 lines for tanzu)
- Streamlined user experience thanks to a completion behavior aligned
with the other shells (for example, it does not suggest the = form for
flag completion)
This commit also enables completion descriptions for bash which is
available with Cobra's bash completion v2.
Signed-off-by: Marc Khouzam <kmarc@vmware.com>
Signed-off-by: Marc Khouzam <kmarc@vmware.com>
Bug description
Although I have shell completion correctly working with the bash shell, once I install a new plugin, the shell completion does not include the new plugin. Also, when I remove a plugin, the bash shell completion continues to complete the plugin name as if it was still available.
The problem is that tanzu's bash completion uses a static script that hard-code the list of plugins at the time the script is generated. Every time a plugin is added or removed, the script would need to be re-generated and re-sourced by the user.
This does not happen to the other shells (zsh, fish, powershell) because they use a "dynamic" script that requests shell completions from the tanzu CLI itself at the time they are needed by the user.
Cobra provides such a dynamic solution for bash completion in its bash completion V2 solution: https://github.com/spf13/cobra/blob/main/shell_completions.md#bash-completion-v2
Affected product area (please put an X in all that apply)
Expected behavior
The shell completion should always reflect the current available list of commands/plugins
Steps to reproduce the bug
Version (include the SHA if the version is not obvious)
Today's main branch: 64cda44
Environment where the bug was observed (cloud, OS, etc)
Locally
Relevant Debug Output (Logs, manifests, etc)
The text was updated successfully, but these errors were encountered: