~jjo/bash-completion/fix-bash43-quote_readline_by_ref-tilde-and-double_escaping

« back to all changes in this revision

Viewing changes to completions/tar

  • Committer: Package Import Robot
  • Author(s): Dimitri John Ledkov
  • Date: 2013-12-27 01:28:28 UTC
  • mfrom: (5.1.14 sid)
  • Revision ID: package-import@ubuntu.com-20131227012828-svk9wdy2ghic0cfh
Tags: 1:2.1-2ubuntu1
* Resync with Debian, remaining diff
  * debian/patches/disable-avahi-browse.diff: Disable avahi-browse since
    it scales poorly in the current form: refresh patch
  * mark Multi-Arch:foreign
  * debian/maintscript, debian/postinst:
    - clean etc conffiles on upgrade since completion files are in /usr
      with the new version
  * patches/101_bash_completion.oga_ogv.patch: Increase support for other
    OGG formats including .oga, .ogx, etc. (LP: #311525)

* Dropped changes:
  - patches/103_colormake.patch: Add support for colormake to the make
    completion rules. (LP: #743208)

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
        return 0
13
13
    fi
14
14
 
15
 
    local tars='@(@(tar|gem|spkg)?(.@(Z|[gx]z|bz?(2)|lzma))|t@([glx]z|bz?(2)))'
 
15
    local tars='@(@(tar|gem|spkg)?(.@(Z|[bgx]z|bz2|lz?(ma)))|t@([abglx]z|b?(z)2))'
16
16
 
17
17
    case ${words[1]} in
18
18
        --*)
21
21
            if [[ $cword -eq 2 ]]; then
22
22
                ext='@(tar|gem|spkg)'
23
23
                case ${words[1]} in
24
 
                    *a*)    ext="$tars"         ;;
25
 
                    *z*)    ext='t?(ar.)gz'     ;;
26
 
                    *Z*)    ext='tar.Z'         ;;
27
 
                    *[jy]*) ext='t?(ar.)bz?(2)' ;;
28
 
                    *J*)    ext='t?(ar.)xz'     ;;
 
24
                    *a*)    ext="$tars"               ;;
 
25
                    *z*)    ext='t?(ar.)gz'           ;;
 
26
                    *Z*)    ext='ta@(r.Z|z)'          ;;
 
27
                    *[jy]*) ext='t@(?(ar.)bz?(2)|b2)' ;;
 
28
                    *J*)    ext='t?(ar.)xz'           ;;
29
29
                esac
30
30
                _filedir $ext
31
31
            else
33
33
            fi
34
34
            return 0
35
35
            ;;
36
 
        +([^IZzJjy])f)
 
36
        +([^ZzJjy])f)
37
37
            ext="$tars"
38
 
            regex='\(\(tar\|gem\|spkg\)\(\.\(Z\|[gx]z\|bz2\?\|lzma\)\)\?\|t\([glx]z\|bz2\?\)\)'
 
38
            regex='\(\(tar\|gem\|spkg\)\(\.\(Z\|[bgx]z\|bz2\|lz\(ma\)\?\)\)\?\|t\([abglx]z\|bz\?2\)\)'
39
39
            ;;
40
40
        *[Zz]*f)
41
 
            ext='@(t?(ar.)|gem.|spkg.)@(gz|Z)'
42
 
            regex='\(t\(ar\.\)\?\|gem\.\|spkg\.\)\(gz\|Z\)'
 
41
            ext='@(@(t?(ar.)|gem.|spkg.)@(gz|Z)|taz)'
 
42
            regex='\(\(t\(ar\.\)\?\|gem\.\|spkg\.\)\(gz\|Z\)\|taz\)'
43
43
            ;;
44
 
        *[Ijy]*f)
45
 
            ext='@(@(t?(ar.)|gem.)bz?(2)|spkg)'
46
 
            regex='\(\(t\(ar\.\)\?\|gem\.\)bz2\?\|spkg\)'
 
44
        *[jy]*f)
 
45
            ext='@(@(t?(ar.)|gem.)bz?(2)|spkg|tb2)'
 
46
            regex='\(\(t\(ar\.\)\?\|gem\.\)bz2\?\|spkg\|tb2\)'
47
47
            ;;
48
48
        *[J]*f)
49
 
            ext='@(t?(ar.)|gem.|spkg.)@(lz?(ma)|xz)'
50
 
            regex='\(t\(ar\.\)\?\|gem\.\|spkg\.\)\(lzma\|xz\)\?'
 
49
            ext='@(@(tar|gem|spkg).@(lzma|xz)|t[lx]z)'
 
50
            regex='\(\(tar\|gem\|spkg\)\.\(lzma\|xz\)\|t[lx]z\)'
51
51
            ;;
52
52
        *)
53
53
            _filedir
56
56
    esac
57
57
 
58
58
    case $prev in
59
 
        *$ext)
 
59
        *${ext:-$tars})
60
60
            # complete on files in tar file
61
61
            #
62
62
            # get name of tar file from command line
63
63
            tar=$( sed -e 's/^.* \([^ ]*'$regex'\) .*$/\1/' <<<"${words[@]}" )
64
64
            # devise how to untar and list it
65
 
            untar=t${words[1]//[^IJzjyf]/}
 
65
            untar=t${words[1]//[^Jzjyf]/}
66
66
 
67
67
            local IFS=$'\n'
68
68
            COMPREPLY=( $( compgen -W "$( printf '%s\n' $( tar $untar $tar \