summaryrefslogtreecommitdiff
path: root/etc/bash_completion.d
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2008-02-01 13:40:38 -0800
committerAn-Cheng Huang <ancheng@vyatta.com>2008-02-01 13:40:38 -0800
commit8b12ff7af456406432a0eed0549c24507bdd5d01 (patch)
tree787c059441858f49e4d674bad803a1d4b76b2e83 /etc/bash_completion.d
parent3a116935f46487f1061c0e3d0cfa352bcef4ed66 (diff)
downloadvyatta-cfg-8b12ff7af456406432a0eed0549c24507bdd5d01.tar.gz
vyatta-cfg-8b12ff7af456406432a0eed0549c24507bdd5d01.zip
fix for bug 2614: allow "edit" operation on non-existent nodes.
Diffstat (limited to 'etc/bash_completion.d')
-rw-r--r--etc/bash_completion.d/20vyatta-cfg8
1 files changed, 6 insertions, 2 deletions
diff --git a/etc/bash_completion.d/20vyatta-cfg b/etc/bash_completion.d/20vyatta-cfg
index 6a411de..4a4eb18 100644
--- a/etc/bash_completion.d/20vyatta-cfg
+++ b/etc/bash_completion.d/20vyatta-cfg
@@ -99,6 +99,10 @@ edit ()
local _mpath=${VYATTA_TEMP_CONFIG_DIR}/${VYATTA_EDIT_LEVEL}
local _tpath=${VYATTA_CONFIG_TEMPLATE}/${VYATTA_TEMPLATE_LEVEL}
local idx
+ if ! /opt/vyatta/sbin/my_set $* >&/dev/null 3>&1; then
+ echo "Invalid node \"$*\" for the 'edit' command"
+ return 1
+ fi
for (( idx=1; idx <= num_comp; idx++ )); do
local comp
eval "comp=\$$idx"
@@ -711,9 +715,9 @@ vyatta_config_complete ()
fi
local command=${COMP_WORDS[0]}
- # completion for "set" is different from other commands
+ # completion for "set"/"edit" is different from other commands
is_set=0
- if [ "$command" == "set" ]; then
+ if [ "$command" == "set" -o "$command" == "edit" ]; then
is_set=1
fi
local end_space=0