summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
Diffstat (limited to 'etc')
-rw-r--r--etc/bash_completion.d/10vyatta-op14
1 files changed, 13 insertions, 1 deletions
diff --git a/etc/bash_completion.d/10vyatta-op b/etc/bash_completion.d/10vyatta-op
index c61a3c5..c3a778e 100644
--- a/etc/bash_completion.d/10vyatta-op
+++ b/etc/bash_completion.d/10vyatta-op
@@ -204,6 +204,18 @@ _vyatta_op_set_completions ()
_vyatta_op_completions=($( printf "%s\n" ${completions[@]} | sort -u ))
}
+_vyatta_op_comprely_needs_ambiguity ()
+{
+ local -a uniq
+
+ [ ${#COMPREPLY[@]} -eq 1 ] && return
+
+ uniq=( `printf "%s\n" ${COMPREPLY[@]} | cut -c1 | sort -u` )
+
+ [ ${#uniq[@]} -eq 1 ] && return
+ false
+}
+
_vyatta_op_expand ()
{
local restore_shopts=$( shopt -p extglob nullglob | tr \\n \; )
@@ -249,7 +261,7 @@ _vyatta_op_expand ()
if [ -z "$comp" ] ; then
if [ ${#COMPREPLY[@]} -eq 0 ] ; then
COMPREPLY+=( " " "" )
- else
+ elif _vyatta_op_comprely_needs_ambiguity ; then
COMPREPLY+=( " " )
fi
fi