Skip to content

Commit

Permalink
Merge pull request xapi-project#5967 from last-genius/private/asultan…
Browse files Browse the repository at this point in the history
…ov/autocompletion-fix

xe autocompletion: Exclude previously entered parameters before deciding whether to show optionality of the parameters
  • Loading branch information
last-genius authored Sep 4, 2024
2 parents 0ac2b0b + 911bc2d commit b1fbddc
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ocaml/xe-cli/bash-completion
Original file line number Diff line number Diff line change
Expand Up @@ -814,15 +814,14 @@ set_completions()
if [[ $REQD_OPTIONAL_PARAMS == 1 ]]; then
local reqd_params=$( __preprocess_suggestions "$REQD_PARAMS" )
local opt_params=$( __preprocess_suggestions "$OPT_PARAMS" )
if [[ "$excludes" ]]; then
reqd_params=$(echo "$reqd_params" | eval "grep -v $excludes")
opt_params=$(echo "$opt_params" | eval "grep -v $excludes")
fi
if [[ "$reqd_params" && "$opt_params" ]]; then
__xe_debug "showing optional/required parameters"
SHOW_DESCRIPTION=1

if [[ "$excludes" ]]; then
reqd_params=$(echo "$reqd_params" | eval "grep -v $excludes")
opt_params=$(echo "$opt_params" | eval "grep -v $excludes")
fi

for word in $reqd_params; do
__add_completion "$word" "REQUIRED" "$max_cmd_length"
done
Expand Down

0 comments on commit b1fbddc

Please sign in to comment.