blob: 5cd8f8996cb5f3bf0b2cd1ecce5ab1bdc40ec40c (
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
|
From 1563e1ba9bc2b317390ef305ae9af56a4b976940 Mon Sep 17 00:00:00 2001
From: Peter Wu <lekensteyn@gmail.com>
Date: Sat, 22 Dec 2012 16:37:00 +0100
Subject: [PATCH] etc: make bash completion work for colon values
--chroot (and -c) accept values like chroot:foo and session:foo-abc. Standard
bash completion treats colons as whitespace, hence we need a way to force that
off.
Fix based on http://stackoverflow.com/q/10528695/427545 (thanks Radu Gasler!)
---
etc/bash_completion/schroot | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/etc/bash_completion/schroot b/etc/bash_completion/schroot
index 035f0b3..7cda29b 100644
--- a/etc/bash_completion/schroot
+++ b/etc/bash_completion/schroot
@@ -21,14 +21,14 @@ _schroot()
local cur prev options
COMPREPLY=()
- cur=${COMP_WORDS[COMP_CWORD]}
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref -n : cur prev
# Select precisely the tokens from schroot --help that begin with a dash
options=$(schroot --help | sed 's/\(^\|[[:space:]]\)[^[:space:]-][^[:space:]]*//g')
if [ "$prev" = "-c" ] || [ "$prev" = "--chroot" ]; then
COMPREPLY=( $(compgen -W "$(schroot -a -l)" -- $cur) )
+ __ltrim_colon_completions "$cur"
else
COMPREPLY=( $(compgen -W "$options" -- $cur) )
fi
--
1.8.0.2
|