summaryrefslogtreecommitdiff
path: root/etc/bash_completion.d/20vyatta-cfg
diff options
context:
space:
mode:
Diffstat (limited to 'etc/bash_completion.d/20vyatta-cfg')
-rw-r--r--etc/bash_completion.d/20vyatta-cfg32
1 files changed, 19 insertions, 13 deletions
diff --git a/etc/bash_completion.d/20vyatta-cfg b/etc/bash_completion.d/20vyatta-cfg
index dc05cf1..78f2e0a 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} )