Bash completion V2 with completion descriptions (#1146)
* Bash completion v2 This v2 version of bash completion is based on Go completions. It also supports descriptions like the other shells. Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca> * Only consider matching completions for formatting Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca> * Use bash compV2 for the default completion command Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca> * Update comments that still referred to bash completion Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
This commit is contained in:
@ -2097,9 +2097,9 @@ func TestDefaultCompletionCmd(t *testing.T) {
|
||||
removeCompCmd(rootCmd)
|
||||
|
||||
var compCmd *Command
|
||||
// Test that the --no-descriptions flag is present for the relevant shells only
|
||||
// Test that the --no-descriptions flag is present on all shells
|
||||
assertNoErr(t, rootCmd.Execute())
|
||||
for _, shell := range []string{"fish", "powershell", "zsh"} {
|
||||
for _, shell := range []string{"bash", "fish", "powershell", "zsh"} {
|
||||
if compCmd, _, err = rootCmd.Find([]string{compCmdName, shell}); err != nil {
|
||||
t.Errorf("Unexpected error: %v", err)
|
||||
}
|
||||
@ -2107,14 +2107,6 @@ func TestDefaultCompletionCmd(t *testing.T) {
|
||||
t.Errorf("Missing --%s flag for %s shell", compCmdNoDescFlagName, shell)
|
||||
}
|
||||
}
|
||||
for _, shell := range []string{"bash"} {
|
||||
if compCmd, _, err = rootCmd.Find([]string{compCmdName, shell}); err != nil {
|
||||
t.Errorf("Unexpected error: %v", err)
|
||||
}
|
||||
if flag := compCmd.Flags().Lookup(compCmdNoDescFlagName); flag != nil {
|
||||
t.Errorf("Unexpected --%s flag for %s shell", compCmdNoDescFlagName, shell)
|
||||
}
|
||||
}
|
||||
// Remove completion command for the next test
|
||||
removeCompCmd(rootCmd)
|
||||
|
||||
|
Reference in New Issue
Block a user