diff options
Diffstat (limited to 'completions/povray')
-rw-r--r-- | completions/povray | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/completions/povray b/completions/povray index a843a5cb..e5ef9df6 100644 --- a/completions/povray +++ b/completions/povray @@ -1,13 +1,13 @@ -# povray completion by "David Necas (Yeti)" <yeti@physics.muni.cz> +# povray completion -*- shell-script -*- +# by "David Necas (Yeti)" <yeti@physics.muni.cz> -have povray || have xpovray || have spovray && _povray() { - local cur prev povcur pfx oext defoext - defoext=png # default output extension, if cannot be determined FIXME + local cur prev words cword + _init_completion || return - COMPREPLY=() - _get_comp_words_by_ref -c povcur prev + local povcur=$cur pfx oext defoext + defoext=png # default output extension, if cannot be determined FIXME _expand || return 0 @@ -21,14 +21,14 @@ _povray() ;; [-+]O*) # guess what output file type user may want - case $( ( IFS=$'\n'; command grep '^[-+]F' <<<"${COMP_WORDS[*]}" ) ) in + case $( ( IFS=$'\n'; command grep '^[-+]F' <<<"${words[*]}" ) ) in [-+]FN) oext=png ;; [-+]FP) oext=ppm ;; [-+]F[CT]) oext=tga ;; *) oext=$defoext ;; esac # complete filename corresponding to previously specified +I - COMPREPLY=( $( ( IFS=$'\n'; command grep '^[-+]I' <<<"${COMP_WORDS[*]}" ) ) ) + COMPREPLY=( $( ( IFS=$'\n'; command grep '^[-+]I' <<<"${words[*]}" ) ) ) COMPREPLY=( ${COMPREPLY[@]#[-+]I} ) COMPREPLY=( ${COMPREPLY[@]/%.pov/.$oext} ) cur="${povcur#[-+]O}" # to confuse _filedir @@ -48,7 +48,6 @@ _povray() return 0 ;; *) - cur="$povcur" _filedir '@(ini|pov)' return 0 ;; @@ -56,10 +55,4 @@ _povray() } && complete -F _povray povray xpovray spovray -# Local variables: -# mode: shell-script -# sh-basic-offset: 4 -# sh-indent-comment: t -# indent-tabs-mode: nil -# End: # ex: ts=4 sw=4 et filetype=sh |