bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.30.3
by Martin von Gagern
Lazy initialization |
1 |
# Copyright (C) 2010 Martin von Gagern
|
2 |
#
|
|
3 |
# This file is part of bzr-bash-completion
|
|
4 |
#
|
|
5 |
# bzr-bash-completion free software: you can redistribute it and/or
|
|
6 |
# modify it under the terms of the GNU General Public License as
|
|
7 |
# published by the Free Software Foundation, either version 2 of the
|
|
8 |
# License, or (at your option) any later version.
|
|
9 |
#
|
|
10 |
# bzr-bash-completion is distributed in the hope that it will be
|
|
11 |
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
12 |
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
13 |
# General Public License for more details.
|
|
14 |
#
|
|
15 |
# You should have received a copy of the GNU General Public License
|
|
16 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17 |
||
18 |
# Programmable completion for the Bazaar-NG bzr command under bash.
|
|
19 |
# Source this file (or add it to your ~/.bash_completion or ~/.bashrc
|
|
20 |
# file, depending on your system configuration, and start a new shell)
|
|
21 |
# and bash's completion mechanism will know all about bzr's options!
|
|
22 |
#
|
|
23 |
# This completion function assumes you have the bzr-bash-completion
|
|
24 |
# plugin installed as a bzr plugin. It will generate the full
|
|
25 |
# completion function at first invocation, thus avoiding long delays
|
|
26 |
# for every shell you start.
|
|
27 |
||
28 |
shopt -s progcomp |
|
29 |
_bzr_lazy () |
|
30 |
{
|
|
31 |
unset _bzr |
|
32 |
eval "$(bzr bash-completion)" |
|
33 |
if [[ $(type -t _bzr) == function ]]; then |
|
34 |
unset _bzr_lazy |
|
35 |
_bzr
|
|
36 |
return $? |
|
37 |
else |
|
38 |
return 1 |
|
39 |
fi |
|
40 |
}
|
|
41 |
complete -F _bzr_lazy -o default bzr |