Browse Source

Tools: completion: simplify bash completion for sim_vehicle.py

zr-v5.1
Pierre Kancir 5 years ago committed by Peter Barker
parent
commit
aac416deb1
  1. 4
      Tools/completion/bash/_sim_vehicle

4
Tools/completion/bash/_sim_vehicle

@ -64,7 +64,6 @@ _sim_vehicle() { @@ -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() { @@ -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…
Cancel
Save