summaryrefslogtreecommitdiff
blob: b9dac93ea2407e5ae35b7598ac1c7463c57e691b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Gentoo Linux Repoman Command Completion
#
# $Id$
#
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later

# repoman completion by Jeremy Olexa <darkside@gentoo.org>
# rewrite by Ryan Hill <dirtyepic@gentoo.org>

_repoman()
{
    local cur prev opts modes split=false

    COMPREPLY=()
    opts="$(_parse_help ${COMP_WORDS[0]}) --commitmsg --commitmsgfile"
    modes="ci commit fix full help manifest manifest-check scan"

    _get_comp_words_by_ref -n = cur prev
    _split_longopt && split=true

    case $prev in
        -h|--help|help|-m|--commitmsg|-V|--version)
            return 0
            ;;
        --commitmsgfile)
            _filedir
            return 0
            ;;
        --digest|--if-modified)
            COMPREPLY=( $(compgen -W 'y n' -- "$cur") )
            return 0
            ;;
        --echangelog)
            COMPREPLY=( $(compgen -W 'y n force' -- "$cur") )
            return 0
            ;;
        --mode)
            COMPREPLY=( $(compgen -W "${modes}" -- "$cur") )
            return 0
            ;;
        --vcs)
            COMPREPLY=( $(compgen -W 'cvs svn git bzr hg' -- "$cur") )
            return 0
            ;;
    esac

    $split && return 0

    case $cur in
        -*)
            COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
            return 0
            ;;
        *)
            COMPREPLY=( $(compgen -W "$modes" -- "$cur") )
            return 0
            ;;
    esac

    return 0
} &&
complete -F _repoman repoman

# vim: ft=sh:et:ts=4:sw=4:tw=80