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

« back to all changes in this revision

Viewing changes to completions/ipv6calc

  • Committer: Package Import Robot
  • Author(s): David Paleino
  • Date: 2011-02-06 22:00:58 UTC
  • mfrom: (1.1.4)
  • mto: (5.1.9 sid)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20110206220058-zfh1gyor3vp1goqc
Tags: 1:1.3-1
* New upstream release
  - Fixed "service" completion, thanks to John Hedges (Closes: #586210)
  - Fixed typo in openssl completion (Closes: #609552)
  - Added ip completion (Closes: #600617)
  - Added _tilde(), fix ~username completion (Closes: #587095)
  - Add *.webm to mplayer file completions (Closes: #588079).
* debian/watch: fix to handle .tar.bz2 files
* Bump Standards-Version to 3.9.1, no changes needed
* Install upstream CHANGES file
* Update copyright years in debian/copyright
* debian/rules: reflect new source layout

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 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