# 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 ")"
opts=$($caller --list-vehicle)
opts=$($caller --list-vehicle)
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
return 0
return 0
@ -72,8 +71,7 @@ _sim_vehicle() {
-f | --frame)
-f | --frame)
# 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 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 --list-vehicle)
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')