You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.4 KiB
66 lines
1.4 KiB
#!/usr/bin/env bash |
|
|
|
_waf() |
|
{ |
|
local cur prev opts |
|
COMPREPLY=() |
|
cur="${COMP_WORDS[COMP_CWORD]}" |
|
prev="${COMP_WORDS[COMP_CWORD-1]}" |
|
|
|
# TODO: generate for waf help |
|
opts="--help -h" |
|
opts+=" -j --jobs" |
|
opts+=" -v --verbose" |
|
opts+=" --debug" |
|
opts+=" --bootloader" |
|
opts+=" --default-parameters" |
|
opts+=" --enable-sfml" |
|
opts+=" --enable-sfml-audio" |
|
opts+=" --sitl-osd" |
|
opts+=" --sitl-rgbled" |
|
opts+=" --build-dates" |
|
opts+=" --sitl-flash-storage" |
|
opts+=" --upload" |
|
opts+=" --board" |
|
|
|
opts+=" AP_Periph" |
|
opts+=" copter" |
|
opts+=" heli" |
|
opts+=" plane" |
|
opts+=" rover" |
|
opts+=" sub" |
|
opts+=" antennatracker" |
|
opts+=" tools" |
|
opts+=" examples" |
|
opts+=" bootloader" |
|
opts+=" iofirmware" |
|
opts+=" list" |
|
opts+=" all" |
|
opts+=" build" |
|
opts+=" configure" |
|
opts+=" clean" |
|
opts+=" distclean" |
|
|
|
# Prevent word reuse TODO: add -vvv case |
|
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 |
|
|
|
case $prev in |
|
--board) |
|
opts=$(./waf list_boards | sed -e '$d') |
|
COMPREPLY=($(compgen -W "${opts}" -- ${cur})) |
|
return 0 |
|
;; |
|
esac |
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) |
|
} |
|
|
|
|
|
complete -F _waf waf
|
|
|