summaryrefslogtreecommitdiff
path: root/bash-completion
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2018-04-05 06:08:48 (GMT)
committerAlexey Neyman <stilor@att.net>2018-04-07 19:03:17 (GMT)
commitb670aaf1ad5ed2531079a7992b6feb87c0b3b9ea (patch)
tree7fd5eb039394dd936d89bf803bbaf951389f7693 /bash-completion
parent970811a1c58d22fad37d8cbe2233b8344f358e78 (diff)
Install bash completion into new location
/share/bash-completion/completions rather than /etc/bash_completion.d Signed-off-by: Alexey Neyman <stilor@att.net>
Diffstat (limited to 'bash-completion')
-rw-r--r--bash-completion/ct-ng.in36
1 files changed, 36 insertions, 0 deletions
diff --git a/bash-completion/ct-ng.in b/bash-completion/ct-ng.in
new file mode 100644
index 0000000..f38c881
--- /dev/null
+++ b/bash-completion/ct-ng.in
@@ -0,0 +1,36 @@
+# To be sourced
+
+_ct_ng () {
+ local cur prev samples show_samples actions steps start_steps stop_steps ct_ng_opts vars
+ COMPREPLY=()
+ cur=$(_get_cword)
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ samples=$( "${COMP_WORDS[0]}" list-samples-short 2>/dev/null )
+ show_samples=$(echo "${samples}" |sed -r -e 's/(^| )/\1show-/g;')
+ build_samples=$(echo "${samples}" |sed -r -e 's/(^| )/\1build-/g;')
+ check_samples=$(echo "${samples}" |sed -r -e 's/(^| )/\1check-/g;')
+
+ steps=$(${COMP_WORDS[0]} list-steps 2>/dev/null |awk '$1 == "-" { print $2; }')
+ start_steps=$(echo "${steps}" |sed -r -e 's/($| )/\1+/;')
+ stop_steps=$(echo "${steps}" |sed -r -e 's/(^| )/+\1/;')
+
+ actions='help menuconfig nconfig oldconfig saveconfig extractconfig
+ defconfig savedefconfig
+ build build-all
+ wiki-samples list-samples list-samples-short check-samples
+ list-steps
+ show-tuple show-all show-config
+ clean distclean updatetools
+ version'
+
+ vars="RESTART= STOP= PREFIX= V= DEFCONFIG="
+
+ ct_ng_opts="${samples} ${show_samples} ${build_samples} ${check_samples}
+ ${steps} ${start_steps} ${stop_steps}
+ ${actions} ${vars}"
+
+ COMPREPLY=($(compgen -W "${ct_ng_opts}" -- "${cur}"))
+ return 0
+}
+complete -F _ct_ng @progname@