The script looks fine in general, but I have to make some remarks about it.
* There are some minor cosmetic fixes could be done. For example ${words[$((cword-2))]} could be replaced with ${words[cword-2]}. * The bigger problem is that you are seems to forgot to suppress error messages of external utils like grep. * Handling options with "no argument" looks suspicious: ------------------------------------------ # no argument --getdisplaystatus|--displayoutput) return 0 ;; ------------------------------------------ if some option really doesn't have arguments, then you shouldn't look at it in "case $prev in ..." -- no argument, no completion -- otherwise you will break completion of $cur word. But if those options does have arguments, you should change the comment to "argument required, but no completion available" to be clear. * Multilevel arguments should be handled starting from the deepest ones. So the code should look like this: ------------------------------------------ # handle $pprev if [[ $((cword-2)) -ge 1 && ${words[cword-2]} =~ --*]]; then case ${words[cword-2]} in ... esac fi # handle $prev case $prev in ... esac # handle $cur ... COMPREPLY=( $( compgen -W "$all_cmd" -- "$cur" ) ) ------------------------------------------ -- Igor On Sun, 7 Oct 2012 17:34:18 +0200 Raphaël <raphael.d...@gmail.com> wrote: > hi, > > AFAIR the policy of bash-completion is to have completions maintained > upstream if it's possible. > > A bash completion for gnokii, which probably needs a review, is waiting > here [1] for some time. > While not absolutely complete it's already quite handy and compatible > with bash-completion 2.0. > > > > enjoy > > > [1] > https://gitorious.org/drzraf/bash-completion/blobs/master/completions/gnokii > (attached too) > > > CC: bash-completion people in case they find something wrong with it _______________________________________________ Bash-completion-devel mailing list Bash-completion-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/bash-completion-devel