~ubuntu-branches/ubuntu/vivid/bash-completion/vivid-proposed

« back to all changes in this revision

Viewing changes to contrib/ipv6calc

  • Committer: Package Import Robot
  • Author(s): Angel Abad
  • Date: 2011-02-08 09:39:13 UTC
  • mfrom: (5.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20110208093913-89h9hx9eq5j7vjpw
Tags: 1:1.3-1ubuntu1
* Merge from debian unstable. (LP: #715057) Remaining changes:
  - debian/patches/disable-avahi-browse.diff: Disable avahi-browse since
    it scales poorly in the current form:
    + Refresh patch
  - debian/patches/apt-get-changelog.patch:
    + Re-work patch because contrib dir no longer exists in upstream
      distribution.
* Dropped chages, applied upstream:
  - Fix p4 completion
  - Fix typo in openssl completion
  - Fix error while loading service(8) completions

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
have ipv6calc &&
2
 
_ipv6calc()
3
 
{
4
 
    local cur prev split=false
5
 
 
6
 
    COMPREPLY=()
7
 
    _get_comp_words_by_ref -n = cur prev
8
 
    #cur=`_get_cword =`
9
 
    #prev=`_get_pword`
10
 
 
11
 
    _split_longopt && split=true
12
 
 
13
 
    case "$prev" in
14
 
        -d|--debug)
15
 
            return 0
16
 
            ;;
17
 
        -I|--in|-O|--out|-A|--action)
18
 
            # With ipv6calc < 0.73.0, -m does nothing here, so use sed instead.
19
 
            COMPREPLY=( $( compgen -W "$( ipv6calc "$prev" -h 2>&1 | \
20
 
                sed -ne 's/^[[:space:]]\{1,\}\([^[:space:]:]\{1,\}\)[[:space:]]*:.*/\1/p' )" \
21
 
                -- "$cur" ) )
22
 
            return 0
23
 
            ;;
24
 
        --db-geoip|--db-ip2location-ipv4|--db-ip2location-ipv6)
25
 
            _filedir
26
 
            return 0
27
 
            ;;
28
 
        --printstart|--printend)
29
 
            return 0
30
 
            ;;
31
 
    esac
32
 
 
33
 
    $split && return 0
34
 
 
35
 
    if [[ "$cur" == -* ]]; then
36
 
        COMPREPLY=( $( compgen -W '--help --debug --quiet --in \
37
 
            --out --action --examples --showinfo --show_types \
38
 
            --machine_readable --db-geoip --db-geoip-default \
39
 
            --db-ip2location-ipv4 --db-ip2location-ipv6 \
40
 
            --lowercase --uppercase --printprefix --printsuffix \
41
 
            --maskprefix --masksuffix --printstart --printend \
42
 
            --printcompressed --printuncompressed \
43
 
            --printfulluncompressed --printmirrored' -- "$cur" ) )
44
 
        return 0
45
 
    fi
46
 
 
47
 
    return 0
48
 
} &&
49
 
complete -F _ipv6calc -o filenames ipv6calc
50
 
 
51
 
# Local variables:
52
 
# mode: shell-script
53
 
# sh-basic-offset: 4
54
 
# sh-indent-comment: t
55
 
# indent-tabs-mode: nil
56
 
# End:
57
 
# ex: ts=4 sw=4 et filetype=sh