Skip to content

Commit b1fbddc

Browse files
authored
Merge pull request #5967 from last-genius/private/asultanov/autocompletion-fix
xe autocompletion: Exclude previously entered parameters before deciding whether to show optionality of the parameters
2 parents 0ac2b0b + 911bc2d commit b1fbddc

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

ocaml/xe-cli/bash-completion

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -814,15 +814,14 @@ set_completions()
814814
if [[ $REQD_OPTIONAL_PARAMS == 1 ]]; then
815815
local reqd_params=$( __preprocess_suggestions "$REQD_PARAMS" )
816816
local opt_params=$( __preprocess_suggestions "$OPT_PARAMS" )
817+
if [[ "$excludes" ]]; then
818+
reqd_params=$(echo "$reqd_params" | eval "grep -v $excludes")
819+
opt_params=$(echo "$opt_params" | eval "grep -v $excludes")
820+
fi
817821
if [[ "$reqd_params" && "$opt_params" ]]; then
818822
__xe_debug "showing optional/required parameters"
819823
SHOW_DESCRIPTION=1
820824

821-
if [[ "$excludes" ]]; then
822-
reqd_params=$(echo "$reqd_params" | eval "grep -v $excludes")
823-
opt_params=$(echo "$opt_params" | eval "grep -v $excludes")
824-
fi
825-
826825
for word in $reqd_params; do
827826
__add_completion "$word" "REQUIRED" "$max_cmd_length"
828827
done

0 commit comments

Comments
 (0)