skip filtering on completing dirs/files

This commit is contained in:
Roberto Hidalgo 2023-01-14 17:10:59 -06:00
parent db21a53b2d
commit a14ffd07b9
2 changed files with 2 additions and 2 deletions

View File

@ -127,7 +127,7 @@ func (args *Arguments) CompletionFunction(cc *cobra.Command, provided []string,
values = cobra.AppendActiveHelp(values, arg.Description) values = cobra.AppendActiveHelp(values, arg.Description)
} }
if toComplete != "" { if toComplete != "" && directive != cobra.ShellCompDirectiveFilterFileExt && directive != cobra.ShellCompDirectiveFilterDirs {
filtered := []string{} filtered := []string{}
for _, value := range values { for _, value := range values {
if strings.HasPrefix(value, toComplete) { if strings.HasPrefix(value, toComplete) {

View File

@ -174,7 +174,7 @@ func (opt *Option) CompletionFunction(cmd *cobra.Command, args []string, toCompl
return values, cobra.ShellCompDirectiveError return values, cobra.ShellCompDirectiveError
} }
if toComplete != "" { if toComplete != "" && flag != cobra.ShellCompDirectiveFilterFileExt && flag != cobra.ShellCompDirectiveFilterDirs {
filtered := []string{} filtered := []string{}
for _, value := range values { for _, value := range values {
if strings.HasPrefix(value, toComplete) { if strings.HasPrefix(value, toComplete) {