~ubuntu-branches/ubuntu/trusty/dput-ng/trusty-proposed

« back to all changes in this revision

Viewing changes to debian/dput-ng.bash-completion

  • Committer: Package Import Robot
  • Author(s): Paul Tagliamonte, Paul Tagliamonte, James Page, Luca Falavigna
  • Date: 2013-09-08 14:47:51 UTC
  • mfrom: (6.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20130908144751-1as337x4kuc1dikq
Tags: 1.6
* The "Well, shit, release names are hard too" release

[ Paul Tagliamonte ]
* Add BYHAND handling. (Closes: #719975)
* Change default profile to "boring" rather than "debian". This caused
  non-Debian targets to target Debian codenames.
  Which sucks. (Closes: #718384)

[ James Page ]
* Add in codenames for Ubuntu. (Closes: #714103)

[ Luca Falavigna ]
* Fix path of local profiles in bash-completion script.
* Install dput.commands.contrib package.
* Add bash completion for dcut.
* Add support for Deb-o-Matic builddep command.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
# Debian dput(1) completion
4
4
# Copyright 2002 Roland Mas <lolando@debian.org>
5
5
# Copyright 2012 Salvatore Bonaccorso <carnil@debian.org>
 
6
# Copyright 2013 Luca Falavigna <dktrkranz@debian.org>
6
7
 
7
8
have dput &&
8
9
_dput()
21
22
    {
22
23
        grep "^\[.*\]" $HOME/.dput.cf 2> /dev/null | tr -d [] || /bin/true
23
24
        grep "^\[.*\]" /etc/dput.cf 2> /dev/null | tr -d [] || /bin/true
24
 
        for file in $(ls $HOME/dput.d/profiles/*.json 2> /dev/null); do \
 
25
        for file in $(ls $HOME/.dput.d/profiles/*.json 2> /dev/null); do \
25
26
            basename $file .json; \
26
27
        done || /bin/true
27
28
        for file in $(ls /etc/dput.d/profiles/*.json 2> /dev/null); do \
56
57
 
57
58
}
58
59
[ "$have" ] && complete -F _dput -o filenames -o plusdirs dput
 
60
 
 
61
have dcut &&
 
62
_dcut()
 
63
{
 
64
    local cur prev options paroptions hosts
 
65
 
 
66
    COMPREPLY=()
 
67
    cur=${COMP_WORDS[COMP_CWORD]}
 
68
    prev=${COMP_WORDS[COMP_CWORD-1]}
 
69
    options='-c --config -d --debug -f --force -k --keyid -m --maintainer \
 
70
             -O --output -P --passive -s --simulate -v --version'
 
71
 
 
72
    hosts=$(
 
73
    {
 
74
        grep "^\[.*\]" $HOME/.dput.cf 2> /dev/null | tr -d [] || /bin/true
 
75
        grep "^\[.*\]" /etc/dput.cf 2> /dev/null | tr -d [] || /bin/true
 
76
        for file in $(ls $HOME/.dput.d/profiles/*.json 2> /dev/null); do \
 
77
            basename $file .json; \
 
78
        done || /bin/true
 
79
        for file in $(ls /etc/dput.d/profiles/*.json 2> /dev/null); do \
 
80
            basename $file .json; \
 
81
        done || /bin/true
 
82
        for file in $(ls /usr/share/dput-ng/profiles/*.json 2> /dev/null); do \
 
83
            basename $file .json; \
 
84
        done || /bin/true
 
85
    } | grep -v '^DEFAULT$' | sort -u)
 
86
 
 
87
    commands=$(
 
88
    {
 
89
        cmd="import dput\n"
 
90
        cmd=$cmd"try:\n"
 
91
        cmd=$cmd"    profile = dput.profile.load_profile('$prev')\n"
 
92
        cmd=$cmd"    cmds = dput.command.load_commands(profile)\n"
 
93
        cmd=$cmd"except dput.exceptions.DputConfigurationError:\n"
 
94
        cmd=$cmd"    cmds = []\n"
 
95
        cmd=$cmd"print ' '.join([x.name_and_purpose()[0] for x in cmds])"
 
96
        echo $cmd | sed 's/\\n/\'$'\n/g' | python
 
97
    } | sort -u)
 
98
 
 
99
    paroptions="$options $hosts $commands"
 
100
 
 
101
    case $prev in
 
102
    --config|-c)
 
103
        COMPREPLY=( $( compgen -o filenames -G "$cur*" ) )
 
104
        ;;
 
105
    *)
 
106
        COMPREPLY=( $(
 
107
            compgen -G "${cur}*.changes"
 
108
            compgen -W "$paroptions" | grep "^$cur"
 
109
        ) )
 
110
        ;;
 
111
    esac
 
112
 
 
113
    return 0
 
114
 
 
115
}
 
116
[ "$have" ] && complete -F _dcut -o filenames -o plusdirs dcut