yann@835: # To be sourced yann@835: yann@835: _ct-ng () { yann@835: local cur prev samples show_samples actions steps start_steps stop_steps ct_ng_opts vars yann@835: COMPREPLY=() yann@835: cur=$(_get_cword) yann@835: prev=${COMP_WORDS[COMP_CWORD-1]} yann@835: yann@2053: samples=$( "${COMP_WORDS[0]}" list-samples-short 2>/dev/null ) yann@835: show_samples=$(echo "${samples}" |sed -r -e 's/(^| )/\1show-/g;') yann@1025: build_samples=$(echo "${samples}" |sed -r -e 's/(^| )/\1build-/g;') yann@835: yann@918: steps=$(${COMP_WORDS[0]} list-steps 2>/dev/null |awk '$1 == "-" { print $2; }') yann@934: start_steps=$(echo "${steps}" |sed -r -e 's/($| )/\1+/;') yann@835: stop_steps=$(echo "${steps}" |sed -r -e 's/(^| )/+\1/;') yann@835: yann@1803: actions='help menuconfig oldconfig saveconfig extractconfig yann@1025: build build. build-all build-all. yann@2053: wiki-samples list-samples list-samples-short list-steps yann@2053: show-tuple show-all show-config yann@2053: clean distclean updatetools yann@932: tarball version' yann@835: yann@1876: vars="RESTART= STOP= PREFIX= V=" yann@835: yann@1025: ct_ng_opts="${samples} ${show_samples} ${build_samples} yann@835: ${steps} ${start_steps} ${stop_steps} yann@835: ${actions} ${vars}" yann@835: yann@835: COMPREPLY=($(compgen -W "${ct_ng_opts}" -- "${cur}")) yann@835: return 0 yann@835: } yann@835: complete -F _ct-ng ct-ng