summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorTom Grennan <tgrennan@io.vyatta.com>2007-12-13 18:36:43 -0800
committerTom Grennan <tgrennan@io.vyatta.com>2007-12-13 18:36:43 -0800
commit8d6bac43ac6604b3c2a0ac9315a2e5c168299a5a (patch)
tree4764a95a26a97186c638b8c37ce5335d7df85b8e /etc
parent9a781e1b6dbdba52ea430499d48730b6b311dd5c (diff)
parentfddadb2df7980fe86deabb0bfa27189d52479a0e (diff)
downloadvyatta-cfg-8d6bac43ac6604b3c2a0ac9315a2e5c168299a5a.tar.gz
vyatta-cfg-8d6bac43ac6604b3c2a0ac9315a2e5c168299a5a.zip
Merge branch 'master' of http://phuket.vyatta.com/vyatta-cfg
Diffstat (limited to 'etc')
-rw-r--r--etc/bash_completion.d/20vyatta-cfg32
-rw-r--r--etc/default/vyatta-cfg21
2 files changed, 31 insertions, 22 deletions
diff --git a/etc/bash_completion.d/20vyatta-cfg b/etc/bash_completion.d/20vyatta-cfg
index ecf414d..bc9088f 100644
--- a/etc/bash_completion.d/20vyatta-cfg
+++ b/etc/bash_completion.d/20vyatta-cfg
@@ -647,6 +647,17 @@ ENDCOMMENT
vyatta_help_text="\\nNo help text available"
}
+generate_pipe_help ()
+{
+ local -a hcomps=( "${_vyatta_pipe_completions[@]}" \
+ "${_vyatta_pipe_noncompletions[@]}" )
+ local -a hstrs=()
+ for comp in "${hcomps[@]}"; do
+ hstrs+=("$(_vyatta_pipe_help "$comp")")
+ done
+ generate_help_text hcomps hstrs
+}
+
vyatta_config_complete ()
{
local restore_shopts=$( shopt -p extglob nullglob | tr \\n \; )
@@ -660,6 +671,14 @@ vyatta_config_complete ()
vyatta_do_help=0
fi
+ # handle pipe
+ if _vyatta_pipe_completion "${COMP_WORDS[@]}"; then
+ generate_pipe_help
+ vyatta_completions=( "${_vyatta_pipe_completions[@]}" )
+ vyatta_do_complete
+ return
+ fi
+
if (( ${#COMP_WORDS[@]} < 2 )); then
declare -a hitems=( "commit" \
"delete" \
@@ -707,19 +726,6 @@ vyatta_config_complete ()
(( num_comp -= 1 ))
fi
- # handle pipe
- if [ "${COMP_WORDS[$num_comp]}" == "|" ]; then
- declare -a hitems=( "more" \
- )
- declare -a hstrs=( \
- "Paginate the output" \
- )
- generate_help_text hitems hstrs
- vyatta_completions=( "${hitems[@]}" )
- vyatta_do_complete
- return
- fi
-
(( last_idx = num_comp - 1 ))
comp_words=( ${COMP_WORDS[@]:1:$num_comp} )
diff --git a/etc/default/vyatta-cfg b/etc/default/vyatta-cfg
index d369e0f..e560788 100644
--- a/etc/default/vyatta-cfg
+++ b/etc/default/vyatta-cfg
@@ -1,15 +1,18 @@
# Vyatta shell environment variables for config mode
# should be sourced from /etc/default/vyatta
-export VYATTA_ACTIVE_CONFIGURATION_DIR=${vyatta_configdir}/active
-export VYATTA_CHANGES_ONLY_DIR=${vyatta_configdir}/tmp/changes_only_$$
-export VYATTA_TEMP_CONFIG_DIR=${vyatta_configdir}/tmp/new_config_$$
-export VYATTA_CONFIG_TMP=${vyatta_configdir}/tmp/tmp_$$
-export VYATTA_CONFIG_TEMPLATE=$vyatta_cfg_templates
-export VYATTA_EDIT_LEVEL=/
-export VYATTA_TEMPLATE_LEVEL=/
-export VYATTA_TAG_NAME=node.tag
-export VYATTA_MOD_NAME=.modified
+{
+declare -x -r VYATTA_ACTIVE_CONFIGURATION_DIR=${vyatta_configdir}/active
+declare -x -r VYATTA_CHANGES_ONLY_DIR=${vyatta_configdir}/tmp/changes_only_$$
+declare -x -r VYATTA_TEMP_CONFIG_DIR=${vyatta_configdir}/tmp/new_config_$$
+declare -x -r VYATTA_CONFIG_TMP=${vyatta_configdir}/tmp/tmp_$$
+declare -x -r VYATTA_CONFIG_TEMPLATE=$vyatta_cfg_templates
+declare -x -r VYATTA_EDIT_LEVEL=/
+declare -x -r VYATTA_TEMPLATE_LEVEL=/
+declare -x -r VYATTA_TAG_NAME=node.tag
+declare -x -r VYATTA_MOD_NAME=.modified
+declare -x -r VYATTA_CFG_GROUP_NAME=vyattacfg
+} 2>/dev/null || :
# don't set level if already set
if [ -n "$VYATTA_USER_LEVEL_DIR" ]; then