mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
Tools: completion: simplify bash completion for sim_vehicle.py
This commit is contained in:
parent
25c42b0ea9
commit
aac416deb1
@ -64,7 +64,6 @@ _sim_vehicle() {
|
||||
-v | --vehicle)
|
||||
# get the calling program, remove anything after the space == all commands arguments
|
||||
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 ")"
|
||||
opts=$($caller --list-vehicle)
|
||||
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||
return 0
|
||||
@ -72,8 +71,7 @@ _sim_vehicle() {
|
||||
-f | --frame)
|
||||
# get the calling program, remove anything after the space == all commands arguments
|
||||
local caller; caller=$(echo $@ | sed 's/ .*//g');
|
||||
# Get everything between "frame type" and "-C", remove first and last line, get line starting with caracters and ": " sequence, remove spaces and :
|
||||
local supported_vehicle_list=$($caller --help | sed -n '/frame type/,/-C/p' | sed -e '1d' -e '$d' | sed -n 's/\(.*: \).*/\1/p' | sed -e 's/ //g' -e 's/://g')
|
||||
local supported_vehicle_list=$($caller --list-vehicle)
|
||||
local frames;
|
||||
for v in $supported_vehicle_list
|
||||
do
|
||||
|
Loading…
Reference in New Issue
Block a user