summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2011-10-17 13:43:26 -0500
committerJohn Southworth <john.southworth@vyatta.com>2011-10-17 13:43:26 -0500
commitdb23175f41f01367889e5df7b7a2d60e17079efe (patch)
treec27435cad274bc2b3981b0556edfa208f41ef0ac
parent54c32901389933b1830404f173b338f885add043 (diff)
downloadvyatta-op-db23175f41f01367889e5df7b7a2d60e17079efe.tar.gz
vyatta-op-db23175f41f01367889e5df7b7a2d60e17079efe.zip
Make directory completions, if it is the first word of the completion, work so that users can easily find scripts they may be trying to run.
-rw-r--r--etc/bash_completion.d/vyatta-op5
1 files changed, 4 insertions, 1 deletions
diff --git a/etc/bash_completion.d/vyatta-op b/etc/bash_completion.d/vyatta-op
index 5bcc460..0c75378 100644
--- a/etc/bash_completion.d/vyatta-op
+++ b/etc/bash_completion.d/vyatta-op
@@ -101,7 +101,10 @@ _vyatta_op_debug ()
_vyatta_op_default_expand ()
{
local wc=${#COMP_WORDS[@]}
- if (( wc < 2 )) ||
+ if [[ "${COMP_WORDS[0]}" =~ "/" ]]; then
+ # if we are looking for a directory on the first completion then do directory completions
+ _filedir_xspec
+ elif (( wc < 2 )) ||
[[ $COMP_CWORD -eq 0 ]]; then
_vyatta_op_expand "$@"
else