2008-09-05 10:36:53 +00:00
|
|
|
# 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]}
|
|
|
|
|
2008-10-12 10:38:02 +00:00
|
|
|
samples=$(${COMP_WORDS[0]} list-samples 2>/dev/null)
|
2008-09-05 10:36:53 +00:00
|
|
|
show_samples=$(echo "${samples}" |sed -r -e 's/(^| )/\1show-/g;')
|
2008-10-31 18:31:01 +00:00
|
|
|
build_samples=$(echo "${samples}" |sed -r -e 's/(^| )/\1build-/g;')
|
2008-09-05 10:36:53 +00:00
|
|
|
|
2008-10-12 10:38:02 +00:00
|
|
|
steps=$(${COMP_WORDS[0]} list-steps 2>/dev/null |awk '$1 == "-" { print $2; }')
|
2008-10-14 20:06:37 +00:00
|
|
|
start_steps=$(echo "${steps}" |sed -r -e 's/($| )/\1+/;')
|
2008-09-05 10:36:53 +00:00
|
|
|
stop_steps=$(echo "${steps}" |sed -r -e 's/(^| )/+\1/;')
|
|
|
|
|
2008-10-27 18:39:24 +00:00
|
|
|
actions='help menuconfig oldconfig saveconfig
|
2008-10-31 18:31:01 +00:00
|
|
|
build build. build-all build-all.
|
|
|
|
list-samples list-steps
|
|
|
|
clean distclean wiki-samples updatetools
|
2008-10-14 19:29:25 +00:00
|
|
|
tarball version'
|
2008-09-05 10:36:53 +00:00
|
|
|
|
|
|
|
vars="RESTART= STOP="
|
|
|
|
|
2008-10-31 18:31:01 +00:00
|
|
|
ct_ng_opts="${samples} ${show_samples} ${build_samples}
|
2008-09-05 10:36:53 +00:00
|
|
|
${steps} ${start_steps} ${stop_steps}
|
|
|
|
${actions} ${vars}"
|
|
|
|
|
|
|
|
COMPREPLY=($(compgen -W "${ct_ng_opts}" -- "${cur}"))
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
complete -F _ct-ng ct-ng
|