File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -117,13 +117,29 @@ _comp_compgen__call_builtin() {
117117 local compgen_args=(" $@ " )
118118
119119 # Check for file completion indicators
120- for arg in " ${compgen_args[@]} " ; do
120+ local idx=0
121+ while [[ $idx -lt ${# compgen_args[@]} ]]; do
122+ local arg=" ${compgen_args[$idx]} "
121123 case " $arg " in
122- -f|-d|-A|file|directory)
124+ -f|-d|-Afile|-Adirectory)
125+ is_file_completion=true
126+ break
127+ ;;
128+ -A)
129+ if (( idx + 1 < ${# compgen_args[@]} )) ; then
130+ local next_arg=" ${compgen_args[$((idx + 1))]} "
131+ if [[ " $next_arg " == " file" || " $next_arg " == " directory" ]]; then
132+ is_file_completion=true
133+ break
134+ fi
135+ fi
136+ ;;
137+ file|directory)
123138 is_file_completion=true
124139 break
125140 ;;
126141 esac
142+ (( idx++ ))
127143 done
128144
129145 # Also check if -W option is used with ${files[@]} or similar array expansion
You can’t perform that action at this time.
0 commit comments