mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-05 15:38:29 -04:00
Tools: completion bash: correct word reuse skipping
This commit is contained in:
parent
3262175f86
commit
5736e28693
Tools/completion/bash
@ -37,6 +37,14 @@ _ap_bin()
|
||||
opts+=" --sim-port-in"
|
||||
opts+=" --sim-port-out"
|
||||
opts+=" --irlock-port"
|
||||
# Prevent word reuse
|
||||
lim=$((COMP_CWORD - 1))
|
||||
for i in $(seq 0 $lim); do
|
||||
if [[ $opts == *"${COMP_WORDS[i]}"* ]]; then
|
||||
opts=${opts//${COMP_WORDS[i]}/}
|
||||
opts=${opts//--${COMP_WORDS[i]}/}
|
||||
fi
|
||||
done
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
||||
}
|
||||
|
||||
|
@ -55,8 +55,8 @@ _sim_vehicle() {
|
||||
lim=$((COMP_CWORD - 1))
|
||||
for i in $(seq 0 $lim); do
|
||||
if [[ $opts == *"${COMP_WORDS[i]}"* ]]; then
|
||||
opts=${opts/" ${COMP_WORDS[i]}"/}
|
||||
opts=${opts/" --${COMP_WORDS[i]}"/}
|
||||
opts=${opts//${COMP_WORDS[i]}/}
|
||||
opts=${opts//--${COMP_WORDS[i]}/}
|
||||
fi
|
||||
done
|
||||
|
||||
|
@ -46,8 +46,8 @@ _waf()
|
||||
for i in $( seq 0 $lim )
|
||||
do
|
||||
if [[ $opts == *"${COMP_WORDS[i]}"* ]]; then
|
||||
opts=${opts/" ${COMP_WORDS[i]}"}
|
||||
opts=${opts/" --${COMP_WORDS[i]}"}
|
||||
opts=${opts//${COMP_WORDS[i]}/}
|
||||
opts=${opts//--${COMP_WORDS[i]}/}
|
||||
fi
|
||||
done
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user