From 5ae890a9293cbe4a6c6ef358c07b32b9da7306fb Mon Sep 17 00:00:00 2001 From: An-Cheng Huang Date: Wed, 21 Jul 2010 16:44:27 -0700 Subject: output comp_help in addition to normal help --- etc/bash_completion.d/20vyatta-cfg | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/etc/bash_completion.d/20vyatta-cfg b/etc/bash_completion.d/20vyatta-cfg index cb5e0dc..a96f0d9 100755 --- a/etc/bash_completion.d/20vyatta-cfg +++ b/etc/bash_completion.d/20vyatta-cfg @@ -725,10 +725,6 @@ generate_help_text () declare -a helps eval "items=( \"\${$1[@]}\" )" eval "helps=( \"\${$2[@]}\" )" - if [ -n "$vyatta_cfg_comp_help" ]; then - vyatta_help_text="\\n${vyatta_cfg_comp_help}" - return 0 - fi vyatta_help_text="\\nPossible completions:" for (( idx = 0; idx < ${#items[@]}; idx++ )); do vyatta_help_text="${vyatta_help_text}\\n\\x20\\x20" @@ -741,6 +737,17 @@ generate_help_text () fi vyatta_help_text="${vyatta_help_text}${helps[$idx]}" done + if [ -n "$vyatta_cfg_comp_help" ]; then + vyatta_help_text+="\\n\\nDetailed information:\\n" + local sIFS=$IFS + IFS=' ' + local chstr=$(echo -en "$vyatta_cfg_comp_help\n" \ + | while read comp_help_line; do + echo "vyatta_help_text+=\" $comp_help_line\\n\";" + done) + eval "$chstr" + IFS=$sIFS + fi } # this fills in $vyatta_help_text -- cgit v1.2.3