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@918: samples=$(${COMP_WORDS[0]} list-samples 2>/dev/null) yann@835: show_samples=$(echo "${samples}" |sed -r -e 's/(^| )/\1show-/g;') yann@835: yann@918: steps=$(${COMP_WORDS[0]} list-steps 2>/dev/null |awk '$1 == "-" { print $2; }') yann@835: start_steps=$(echo "${steps}" |sed -r -e 's/(^| )/\1+/;') yann@835: stop_steps=$(echo "${steps}" |sed -r -e 's/(^| )/+\1/;') yann@835: yann@925: actions='menuconfig oldconfig saveconfig yann@918: list-samples build build. list-steps regtest regtest-local yann@848: regtest-global clean distclean wiki-samples updatetools yann@835: tarball' yann@835: yann@835: vars="RESTART= STOP=" yann@835: yann@835: ct_ng_opts="${samples} ${show_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