summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
Diffstat (limited to 'etc')
-rw-r--r--etc/bash_completion.d/20vyatta-cfg35
1 files changed, 34 insertions, 1 deletions
diff --git a/etc/bash_completion.d/20vyatta-cfg b/etc/bash_completion.d/20vyatta-cfg
index 4a4eb18..00482c5 100644
--- a/etc/bash_completion.d/20vyatta-cfg
+++ b/etc/bash_completion.d/20vyatta-cfg
@@ -38,7 +38,7 @@ declare -a comp_words=()
# commands to unalias
declare -a unalias_cmds=( clear configure date debug edit exit load \
- no run set show save terminal undebug )
+ no run set show save terminal undebug up top )
for cmd in "${unalias_cmds[@]}"; do
unalias $cmd >& /dev/null
done
@@ -93,6 +93,19 @@ load ()
eval "${vyatta_sbindir}/vyatta-load-config.pl $@"
}
+top ()
+{
+ if [ "$VYATTA_EDIT_LEVEL" == "/" ]; then
+ echo "Already at the top level"
+ return 0
+ fi
+
+ # go to the top level.
+ export VYATTA_EDIT_LEVEL="/"
+ export VYATTA_TEMPLATE_LEVEL="/"
+ set_config_ps1 ''
+}
+
edit ()
{
local num_comp=${#@}
@@ -158,6 +171,26 @@ edit ()
set_config_ps1 "$path_str"
}
+up ()
+{
+ if [ "$VYATTA_EDIT_LEVEL" == "/" ]; then
+ echo "Already at the top level"
+ return 0
+ fi
+ if [[ $VYATTA_TEMPLATE_LEVEL == */node.tag/ ]]; then
+ export VYATTA_EDIT_LEVEL="${VYATTA_EDIT_LEVEL%/*/*/}/"
+ export VYATTA_TEMPLATE_LEVEL="${VYATTA_TEMPLATE_LEVEL%/*/*/}/"
+ else
+ export VYATTA_EDIT_LEVEL="${VYATTA_EDIT_LEVEL%/*/}/"
+ export VYATTA_TEMPLATE_LEVEL="${VYATTA_TEMPLATE_LEVEL%/*/}/"
+ fi
+
+ declare -a path_arr
+ path_str2arr VYATTA_EDIT_LEVEL path_arr
+ local path_str="${path_arr[*]}"
+ set_config_ps1 "$path_str"
+}
+
really_exit()
{
sudo umount $VYATTA_TEMP_CONFIG_DIR