source: trunk/debathena/third/schroot/etc/bash_completion/schroot @ 24314

Revision 24314, 1.2 KB checked in by geofft, 14 years ago (diff)
In schroot: * Merge with Debian unstable; remaining changes: - Backport to Karmic, and adjust build-deps.
Line 
1# Debian GNU/Linux schroot(1) completion.
2# Copyright © 2009 Tim Abbott <tabbott@mit.edu>
3#
4# schroot is free software: you can redistribute it and/or modify it
5# under the terms of the GNU General Public License as published by
6# the Free Software Foundation, either version 3 of the License, or
7# (at your option) any later version.
8#
9# schroot is distributed in the hope that it will be useful, but
10# WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12# General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program.  If not, see
16# <http://www.gnu.org/licenses/>.
17
18have schroot &&
19_schroot()
20{
21    local cur prev options
22
23    COMPREPLY=()
24    cur=${COMP_WORDS[COMP_CWORD]}
25    prev=${COMP_WORDS[COMP_CWORD-1]}
26
27    # Select precisely the tokens from schroot --help that begin with a dash
28    options=$(schroot --help | sed 's/\(^\|[[:space:]]\)[^[:space:]-][^[:space:]]*//g')
29
30    if [ "$prev" = "-c" ] || [ "$prev" = "--chroot" ]; then
31        COMPREPLY=( $(compgen -W "$(schroot -a -l)" -- $cur) )
32    else
33        COMPREPLY=( $(compgen -W "$options" -- $cur) )
34    fi
35    return 0
36}
37complete -F _schroot schroot
Note: See TracBrowser for help on using the repository browser.