From patchwork Sat Nov 30 22:13:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [v2] Add bash-completion for the buildscript. From: Robert Langhammer X-Patchwork-Id: 1237 Message-Id: <20191130221320.10045-1-rlanghammer@web.de> To: franken-dev@freifunk.net Date: Sat, 30 Nov 2019 23:13:20 +0100 Signed-off-by: Robert Langhammer --- Changes in v2 - moove script to subfolder tools/buildscript-bash-completion . - add parameter updatefeeds. --- tools/buildscript-bash-completion | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tools/buildscript-bash-completion -- 2.20.1 diff --git a/tools/buildscript-bash-completion b/tools/buildscript-bash-completion new file mode 100644 index 0000000..a5c8d87 --- /dev/null +++ b/tools/buildscript-bash-completion @@ -0,0 +1,40 @@ +# completion for buildscript +# just source this script +# or put it in your /etc/bash_completion.d/ (you should rename it) + +_buildscript() { +case "${COMP_WORDS[1]}" in +config) + COMPREPLY=($(compgen -W "openwrt" "${COMP_WORDS[2]}")) + ;; +selectbsp) + COMPREPLY=($(compgen -W "$(find bsp -name '*.bsp')" "${COMP_WORDS[2]}")) + ;; +selectvariant) + COMPREPLY=($(compgen -W "$("${COMP_WORDS[0]}" "${COMP_WORDS[1]}" | sed '0,/available variants:/d')" "${COMP_WORDS[2]}")) + ;; +build) + COMPREPLY=($(compgen -W "fast debug" "${COMP_WORDS[2]}")) + ;; +buildall) + COMPREPLY=($(compgen -W "fast" "${COMP_WORDS[2]}")) + ;; +release) + case "${COMP_WORDS[2]}" in + all) + COMPREPLY=($(compgen -W "fast" "${COMP_WORDS[3]}")) + ;; + fast) + COMPREPLY=($(compgen -W "all" "${COMP_WORDS[3]}")) + ;; + *) + COMPREPLY=($(compgen -W "fast all" "${COMP_WORDS[2]}")) + ;; + esac;; +*) + COMPREPLY=($(compgen -W "selectbsp selectvariant updatefeeds prepare config build buildall release clean" "${COMP_WORDS[1]}")) + ;; +esac +} + +complete -F _buildscript ./buildscript