Updated changes as requested in waf for shell completion

This commit is contained in:
Harsh Pandey 2020-02-12 08:53:11 +05:30 committed by Peter Barker
parent ea3d8046da
commit 070b7c3202
2 changed files with 2 additions and 4 deletions

View File

@ -53,8 +53,7 @@ _waf()
case $prev in
--board)
# get options between board and debug, remove everything before "are", remove everything after "--debug", remove final dot, remove all comma
opts=$(./waf --help | sed -n '/--board=/,/--debug/p' | sed -e 's/.*are //g' -e 's/\(--debug.*\)//g' -e 's/[.]//g' -e 's/[,]//g')
opts=$(./waf list_boards | sed -e '$d')
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
return 0
;;

View File

@ -39,8 +39,7 @@ _waf() {
(( $+functions[_waf_boards] )) ||
_waf_boards() {
# get option between board and debug, remove everything before "are", remove everything after "--debug", remove final dot, remove all comma
local boards; boards=( $(./waf --help | sed -n '/--board=/,/--debug/p' | sed -e 's/.*are //g' -e 's/\(--debug.*\)//g' -e 's/[.]//g' -e 's/[,]//g') )
local boards; boards=( $(./waf list_boards | sed -e '$d'))
_describe -t boards 'board' boards "$@" && ret=0
}