Browse Source

Tools: completion: get boards list from help

c415-sdk
Pierre Kancir 5 years ago committed by Peter Barker
parent
commit
989653bf69
  1. 14
      Tools/completion/bash/_waf
  2. 12
      Tools/completion/zsh/_waf

14
Tools/completion/bash/_waf vendored

@ -51,14 +51,14 @@ _waf() @@ -51,14 +51,14 @@ _waf()
fi
done
# TODO: generate for waf help
case $prev in
--board)
opts="CubeBlack bbbmini fmuv2 fmuv3 fmuv4 iomcu sitl"
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
return 0
;;
esac
--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')
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
return 0
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
}

12
Tools/completion/zsh/_waf vendored

@ -37,18 +37,10 @@ _waf() { @@ -37,18 +37,10 @@ _waf() {
esac
}
# TODO : generate with regex from waf help
(( $+functions[_waf_boards] )) ||
_waf_boards() {
local boards; boards=(
'CubeBlack:builds CubeBlack' \
'bbbmini:build bbbmini' \
'fmuv2:build fmuv2' \
'fmuv3:build fmuv3' \
'fmuv4:build fmuv4' \
'iomcu:build iomcu' \
'sitl:build sitl'
)
# 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') )
_describe -t boards 'board' boards "$@" && ret=0
}

Loading…
Cancel
Save