~ubuntu-branches/ubuntu/trusty/bash-completion/trusty-updates

« back to all changes in this revision

Viewing changes to completions/povray

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher
  • Date: 2012-07-23 16:07:59 UTC
  • mfrom: (5.1.12 sid)
  • Revision ID: package-import@ubuntu.com-20120723160759-lt9vn33dl3nak9l0
Tags: 1:2.0-1ubuntu1
* debian/maintscript, debian/postinst:
  - clean etc conffiles on upgrade since completion files are in /usr
    with the new version
* Resync with Debian, remaining diff
  * debian/patches/disable-avahi-browse.diff: Disable avahi-browse since
    it scales poorly in the current form: refresh patch
  * patches/101_bash_completion.oga_ogv.patch: Increase support for other
    OGG formats including .oga, .ogx, etc. (LP: #311525)
  * patches/103_colormake.patch: Add support for colormake to the make
    completion rules. (LP: #743208)
* Dropped changes:
  * Add conffile upgrade handling for a run of conffiles that were dropped
    since lucid: lucid upgrades are only supported to precise.
* Those fixes are in the new version
  * debian/patches/apt-get-changelog.patch:
  * Drop whitelists if they fail to produce any results:
  * patches/apt-get-download.patch: Add download as an apt-get
    sub-command (LP: #720541)
  * patches/102_manpager.patch: Override MANPAGER when generating perldoc
    completions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# povray completion by "David Necas (Yeti)" <yeti@physics.muni.cz>
 
1
# povray completion                                        -*- shell-script -*-
 
2
# by "David Necas (Yeti)" <yeti@physics.muni.cz>
2
3
 
3
 
have povray || have xpovray || have spovray &&
4
4
_povray()
5
5
{
6
 
    local cur prev povcur pfx oext defoext
 
6
    local cur prev words cword
 
7
    _init_completion || return
 
8
 
 
9
    local povcur=$cur pfx oext defoext
7
10
    defoext=png # default output extension, if cannot be determined FIXME
8
11
 
9
 
    COMPREPLY=()
10
 
    _get_comp_words_by_ref -c povcur prev
11
 
 
12
12
    _expand || return 0
13
13
 
14
14
    case $povcur in
21
21
            ;;
22
22
        [-+]O*)
23
23
            # guess what output file type user may want
24
 
            case $( ( IFS=$'\n'; command grep '^[-+]F' <<<"${COMP_WORDS[*]}" ) ) in
 
24
            case $( ( IFS=$'\n'; command grep '^[-+]F' <<<"${words[*]}" ) ) in
25
25
                [-+]FN) oext=png ;;
26
26
                [-+]FP) oext=ppm ;;
27
27
                [-+]F[CT]) oext=tga ;;
28
28
                *) oext=$defoext ;;
29
29
            esac
30
30
            # complete filename corresponding to previously specified +I
31
 
            COMPREPLY=( $( ( IFS=$'\n'; command grep '^[-+]I' <<<"${COMP_WORDS[*]}" ) ) )
 
31
            COMPREPLY=( $( ( IFS=$'\n'; command grep '^[-+]I' <<<"${words[*]}" ) ) )
32
32
            COMPREPLY=( ${COMPREPLY[@]#[-+]I} )
33
33
            COMPREPLY=( ${COMPREPLY[@]/%.pov/.$oext} )
34
34
            cur="${povcur#[-+]O}" # to confuse _filedir
40
40
        *.ini\[|*.ini\[*[^]]) # sections in .ini files
41
41
            cur="${povcur#*\[}"
42
42
            pfx="${povcur%\["$cur"}" # prefix == filename
43
 
            [ -r "$pfx" ] || return 0
 
43
            [[ -r $pfx ]] || return 0
44
44
            COMPREPLY=( $(sed -e 's/^[[:space:]]*\[\('"$cur"'[^]]*\]\).*$/\1/' \
45
45
                -e 't' -e 'd' -- "$pfx") )
46
46
            # to prevent [bar] expand to nothing.  can be done more easily?
48
48
            return 0
49
49
            ;;
50
50
        *)
51
 
            cur="$povcur"
52
51
            _filedir '@(ini|pov)'
53
52
            return 0
54
53
            ;;
56
55
} &&
57
56
complete -F _povray povray xpovray spovray
58
57
 
59
 
# Local variables:
60
 
# mode: shell-script
61
 
# sh-basic-offset: 4
62
 
# sh-indent-comment: t
63
 
# indent-tabs-mode: nil
64
 
# End:
65
58
# ex: ts=4 sw=4 et filetype=sh