mirror of https://github.com/ArduPilot/ardupilot
Tools: completion: add bash completion for autotest.py
This commit is contained in:
parent
62ec6540ec
commit
3262175f86
|
@ -0,0 +1,55 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
_ap_autotest() {
|
||||
local cur prev opts
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD - 1]}"
|
||||
|
||||
case "$cur" in
|
||||
-*)
|
||||
# TODO: generate for waf help
|
||||
opts="--help -h"
|
||||
opts+=" -j"
|
||||
opts+=" --skip"
|
||||
opts+=" --list"
|
||||
opts+=" --list-subtests"
|
||||
opts+=" --viewerip"
|
||||
opts+=" --map"
|
||||
opts+=" --experimental"
|
||||
opts+=" --timeout"
|
||||
opts+=" --frame"
|
||||
opts+=" --show-test-timings"
|
||||
opts+=" --validate-parameters"
|
||||
opts+=" --no-configure"
|
||||
opts+=" --waf-configure-args"
|
||||
opts+=" --no-clean"
|
||||
opts+=" --debug"
|
||||
opts+=" --speedup"
|
||||
opts+=" --valgrind"
|
||||
opts+=" --gdb"
|
||||
opts+=" --gdbserver"
|
||||
opts+=" --lldb"
|
||||
opts+=" -B --breakpoint"
|
||||
opts+=" --disable-breakpoints"
|
||||
;;
|
||||
*)
|
||||
# get the calling program, remove anything after the space == all commands arguments
|
||||
local caller
|
||||
caller=$(echo $@ | sed 's/ .*//g')
|
||||
opts=$($caller --list)
|
||||
;;
|
||||
# TODO: add completion for subtests and skip list
|
||||
esac
|
||||
# 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}))
|
||||
}
|
||||
|
||||
complete -F _ap_autotest autotest.py
|
|
@ -4,3 +4,4 @@ _AP_COMPLETION_DIR=$(builtin cd "`dirname "${BASH_SOURCE[0]}"`" > /dev/null && p
|
|||
source "$_AP_COMPLETION_DIR/bash/_waf"
|
||||
source "$_AP_COMPLETION_DIR/bash/_sim_vehicle"
|
||||
source "$_AP_COMPLETION_DIR/bash/_ap_bin"
|
||||
source "$_AP_COMPLETION_DIR/bash/_ap_autotest"
|
||||
|
|
Loading…
Reference in New Issue