diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2010-07-21 16:44:27 -0700 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2010-07-21 16:44:27 -0700 |
commit | 5ae890a9293cbe4a6c6ef358c07b32b9da7306fb (patch) | |
tree | 4dabe95752301f7d4bd0f86da9b3aba0b4506632 | |
parent | 23178ba1906bebb908fd17c028b5fd96881e91de (diff) | |
download | vyatta-cfg-5ae890a9293cbe4a6c6ef358c07b32b9da7306fb.tar.gz vyatta-cfg-5ae890a9293cbe4a6c6ef358c07b32b9da7306fb.zip |
output comp_help in addition to normal help
-rwxr-xr-x | etc/bash_completion.d/20vyatta-cfg | 15 |
1 files 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 |