[Buildd-tools-devel] Bug#519745: schroot: Add bash completion script

Tim Abbott tabbott at MIT.EDU
Sat Mar 14 19:41:03 UTC 2009


package: schroot
severity: wishlist
tags: patch

I wrote a bash_completion script for schroot (attached); it completes on 
both option names and chroot names (after the -c argument).

I didn't write a full patch to integrate it with the schroot build system 
since I'm not sure where you'll want to put it.

	-Tim Abbott
-------------- next part --------------
# Debian GNU/Linux schroot(1) completion.
# Copyright ? 2009 Tim Abbott <tabbott at mit.edu>

have schroot &&
_schroot()
{
    local cur prev options

    COMPREPLY=()
    cur=${COMP_WORDS[COMP_CWORD]}
    prev=${COMP_WORDS[COMP_CWORD-1]}
    # Options should probably be autogenerated from the schroot build
    # system, but using the current list is probably fine for now.
    options="--help --version --list --info --config --location --quiet --verbose --chroot --all --all-chroots --all-sessions --directory --user --preserve-environment --automatic-session --begin-session --recover-session --run-session --end-session --session-name --force -h -V -l -i -q -v -c -a -d -u -p -b -r -e -n -f"

    if [ "$prev" = "-c" ]; then
	COMPREPLY=( $(compgen -W "$(schroot -a -l)" -- $cur) )
    else
	COMPREPLY=( $(compgen -W "$options" -- $cur) )
    fi
    return 0
}
complete -F _schroot schroot


More information about the Buildd-tools-devel mailing list