From patchwork Tue Dec 3 16:46:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Some patch to test if patchwork is functional From: Dominik Heidler X-Patchwork-Id: 1233 Message-Id: <4d07a0c1-6c80-b126-981a-475b3cfccf28@heidler.eu> To: franken-dev@freifunk.net Date: Tue, 3 Dec 2019 17:46:44 +0100 Signed-off-by: Robert Langhammer Reviewed-by: Robert Langhammer --- bash-completion.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 bash-completion.sh + +complete -F _buildscript ./buildscript -- 2.20.1 diff --git a/bash-completion.sh b/bash-completion.sh new file mode 100644 index 0000000..d1e20f6 --- /dev/null +++ b/bash-completion.sh @@ -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 prepare config build buildall release clean" "${COMP_WORDS[1]}")) + ;; +esac +}