From ced185b59b0d901792dd863eaf08f253d8e18476 Mon Sep 17 00:00:00 2001 From: Pierre Kancir Date: Sun, 26 Apr 2020 16:01:57 +0200 Subject: [PATCH] Tools: Completion: fix vehicle type competion --- Tools/completion/bash/_sim_vehicle | 2 +- Tools/completion/zsh/_sim_vehicle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tools/completion/bash/_sim_vehicle b/Tools/completion/bash/_sim_vehicle index 0c6bc1fccac65c..2c6488b130a58b 100644 --- a/Tools/completion/bash/_sim_vehicle +++ b/Tools/completion/bash/_sim_vehicle @@ -65,7 +65,7 @@ _sim_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 --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})) return 0 ;; diff --git a/Tools/completion/zsh/_sim_vehicle b/Tools/completion/zsh/_sim_vehicle index fd4f9a2fdb61a3..4c7b0789aa9248 100644 --- a/Tools/completion/zsh/_sim_vehicle +++ b/Tools/completion/zsh/_sim_vehicle @@ -59,7 +59,7 @@ _sim_vehicle() { _get_vehicle_type() { # 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] )) ||