ct-ng.comp
changeset 835 8b976f2f38f9
child 848 5b3785e0d41d
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ct-ng.comp	Fri Sep 05 10:36:53 2008 +0000
     1.3 @@ -0,0 +1,30 @@
     1.4 +# To be sourced
     1.5 +
     1.6 +_ct-ng () {
     1.7 +    local cur prev samples show_samples actions steps start_steps stop_steps ct_ng_opts vars
     1.8 +    COMPREPLY=()
     1.9 +    cur=$(_get_cword)
    1.10 +    prev=${COMP_WORDS[COMP_CWORD-1]}
    1.11 +
    1.12 +    samples=$(${COMP_WORDS[0]} list-samples)
    1.13 +    show_samples=$(echo "${samples}" |sed -r -e 's/(^| )/\1show-/g;')
    1.14 +
    1.15 +    steps=$(${COMP_WORDS[0]} list-steps |awk '$1 == "-" { print $2; }')
    1.16 +    start_steps=$(echo "${steps}" |sed -r -e 's/(^| )/\1+/;')
    1.17 +    stop_steps=$(echo "${steps}" |sed -r -e 's/(^| )/+\1/;')
    1.18 +
    1.19 +    actions='config menuconfig oldconfig saveconfig extractconfig
    1.20 +             list-samples build list-steps regtest regtest-local
    1.21 +             regtest-global clean distclean wiki-samples update-tools
    1.22 +             tarball'
    1.23 +
    1.24 +    vars="RESTART= STOP="
    1.25 +
    1.26 +    ct_ng_opts="${samples} ${show_samples}
    1.27 +                ${steps} ${start_steps} ${stop_steps}
    1.28 +                ${actions} ${vars}"
    1.29 +
    1.30 +    COMPREPLY=($(compgen -W "${ct_ng_opts}" -- "${cur}"))
    1.31 +    return 0
    1.32 +}
    1.33 +complete -F _ct-ng ct-ng