mirror of https://github.com/ArduPilot/ardupilot
Tools: Completion: fix vehicle type competion
This commit is contained in:
parent
64b7e8fb9e
commit
ced185b59b
|
@ -65,7 +65,7 @@ _sim_vehicle() {
|
||||||
# get the calling program, remove anything after the space == all commands arguments
|
# get the calling program, remove anything after the space == all commands arguments
|
||||||
local caller; caller=$(echo $@ | sed 's/ .*//g');
|
local caller; caller=$(echo $@ | sed 's/ .*//g');
|
||||||
# get options between "vehicle type " and closing ")", remove line return, remove spaces, anything before the opening (, remove the "|" and closing ")"
|
# get options between "vehicle type " and closing ")", remove line return, remove spaces, anything before the opening (, remove the "|" and closing ")"
|
||||||
opts=$($caller --help | sed -n '/vehicle type (/,/)/p' | tr '\n' ' ' | sed -e 's/ //g' -e 's/.*(//g' -e 's/[|)]/ /g')
|
opts=$($caller --help | sed -n '/vehicle type/,/)/p' | sed -e '1d' | tr -d '()' | tr '\n' ' ' | sed -e 's/ //g' -e 's/.*(//g' -e 's/[|)]/ /g')
|
||||||
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -59,7 +59,7 @@ _sim_vehicle() {
|
||||||
|
|
||||||
_get_vehicle_type() {
|
_get_vehicle_type() {
|
||||||
# get options between "vehicle type " and closing ")", remove line return, remove spaces, anything before the opening (, remove the "|" and closing ")"
|
# get options between "vehicle type " and closing ")", remove line return, remove spaces, anything before the opening (, remove the "|" and closing ")"
|
||||||
vehicles=( $($caller --help | sed -n '/vehicle type (/,/)/p' | tr '\n' ' ' | sed -e 's/ //g' -e 's/.*(//g' -e 's/[|)]/ /g') )
|
vehicles=( $($caller --help | sed -n '/vehicle type/,/)/p' | sed -e '1d' | tr -d '()' | tr '\n' ' ' | sed -e 's/ //g' -e 's/.*(//g' -e 's/[|)]/ /g') )
|
||||||
}
|
}
|
||||||
|
|
||||||
(( $+functions[_sim_vehicle_vehicles] )) ||
|
(( $+functions[_sim_vehicle_vehicles] )) ||
|
||||||
|
|
Loading…
Reference in New Issue