mirror of https://github.com/ArduPilot/ardupilot
Tools: completion: small correction to zsh
This commit is contained in:
parent
5736e28693
commit
6dce7a88d4
|
@ -5,7 +5,7 @@ _ap_bin() {
|
|||
typeset -A opt_args
|
||||
local context state line curcontext="$curcontext"
|
||||
|
||||
_arguments -C -A -s -S \
|
||||
_arguments -C \
|
||||
'(- 1 *)'{-h,--help}'[display this help information]' \
|
||||
'(-w --wipe)'{-w,--wipe}'[wipe eeprom]' \
|
||||
'(-u --unhide-groups)'{-u,--unhide-groups}'[parameter enumeration ignores AP_PARAM_FLAG_ENABLE]' \
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
#compdef sim_vehicle.py
|
||||
#autoload
|
||||
|
||||
local temp_word
|
||||
local cur cword prev
|
||||
local -a vehicles
|
||||
|
||||
_sim_vehicle() {
|
||||
typeset -A opt_args
|
||||
local context state state_descr line curcontext="$curcontext"
|
||||
cur=${words[CURRENT]}
|
||||
prev=${words[CURRENT-1]}
|
||||
_arguments -C -A -s -S \
|
||||
|
||||
_arguments -C \
|
||||
'(- 1 *)'{-h,--help}'[show help options and exit]' \
|
||||
'(-j --jobs)'{-j,--jobs}'[number of processors to use during build]:int:' \
|
||||
'(-N --no-rebuild)'{-N,--no-rebuild}'[do not rebuild before starting ardupilot]' \
|
||||
|
@ -56,13 +53,11 @@ _sim_vehicle() {
|
|||
'(-v --vehicle)'{-v,--vehicle}'[vehicle type]:vehicle:_sim_vehicle_vehicles' \
|
||||
'(-f --frame)'{-f,--frame}'[set vehicle frame type]:frame:_copter_frames' \
|
||||
&& ret=0
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
_get_vehicle_type() {
|
||||
# get the calling program, remove anything after the space == all commands arguments
|
||||
local caller; caller=$(echo ${words[@]} | sed 's/ .*//g');
|
||||
# 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') )
|
||||
}
|
||||
|
@ -95,9 +90,6 @@ do
|
|||
local_current=$(( $local_current - 1 ))
|
||||
done
|
||||
|
||||
# get the calling program, remove anything after the space == all commands arguments
|
||||
local caller; caller=$(echo ${words[@]} | sed 's/ .*//g');
|
||||
|
||||
# to get the vehicle list :
|
||||
# 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'))
|
||||
|
@ -118,4 +110,6 @@ done
|
|||
_describe -t frames 'frame' frames "$@" && ret=0
|
||||
}
|
||||
|
||||
# get the calling program, remove anything after the space == all commands arguments
|
||||
caller=$(echo ${words[@]} | sed 's/ .*//g');
|
||||
_sim_vehicle "$@"
|
||||
|
|
|
@ -5,7 +5,7 @@ _waf() {
|
|||
typeset -A opt_args
|
||||
local context state line curcontext="$curcontext"
|
||||
|
||||
_arguments -C -A -s -S \
|
||||
_arguments -C \
|
||||
'(- 1 *)--version[show version and exit]' \
|
||||
'(- 1 *)'{-h,--help}'[show help options and exit]' \
|
||||
'1:first arg:_waf_cmds' \
|
||||
|
|
Loading…
Reference in New Issue