diff options
author | Tom Grennan <tgrennan@vyatta.com> | 2008-02-04 10:35:18 -0800 |
---|---|---|
committer | Tom Grennan <tgrennan@vyatta.com> | 2008-02-04 11:22:57 -0800 |
commit | 2af5044992620f2d6b87e2f58626e01da2919cc3 (patch) | |
tree | c793e12113d2024ca9a2e081ab33b872b2547c5d /etc | |
parent | e9d0d23bc8f050bf12be37c75aedaf17e7d27b3c (diff) | |
download | vyatta-op-2af5044992620f2d6b87e2f58626e01da2919cc3.tar.gz vyatta-op-2af5044992620f2d6b87e2f58626e01da2919cc3.zip |
fix (or at least improve) bug 2519
Diffstat (limited to 'etc')
-rw-r--r-- | etc/bash_completion.d/10vyatta-op | 14 |
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 |