diff options
author | Tom Grennan <tgrennan@vyatta.com> | 2007-11-21 10:37:53 -0800 |
---|---|---|
committer | Tom Grennan <tgrennan@vyatta.com> | 2007-11-21 10:37:53 -0800 |
commit | df274321cdc21a2af4e1aeed6fc8cfe9835f0bba (patch) | |
tree | f8d43b0bfece02084801ee3140cbe67114c15d89 /etc | |
parent | c3fcc31fad69cff57a42782bc9f7f7cb7f192d62 (diff) | |
download | vyatta-op-df274321cdc21a2af4e1aeed6fc8cfe9835f0bba.tar.gz vyatta-op-df274321cdc21a2af4e1aeed6fc8cfe9835f0bba.zip |
filter repetitive help strings
Diffstat (limited to 'etc')
-rw-r--r-- | etc/bash_completion.d/10vyatta-op | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/etc/bash_completion.d/10vyatta-op b/etc/bash_completion.d/10vyatta-op index 4d47a8c..c698027 100644 --- a/etc/bash_completion.d/10vyatta-op +++ b/etc/bash_completion.d/10vyatta-op @@ -82,14 +82,16 @@ _vyatta_op_get_node_def_field () # $2...: help _vyatta_op_print_help () { - local label=$1 ; shift + local label=$1 help=$2 - if [ ${#label} -lt 6 ] ; then - echo -ne "\n $label\t\t" $* + if [ ${#help} -eq 0 ] ; then + echo -ne "\n $label" + elif [ ${#label} -lt 6 ] ; then + echo -ne "\n $label\t\t$help" elif [ ${#label} -lt 14 ] ; then - echo -ne "\n $label\t" $* + echo -ne "\n $label\t$help" else - echo -ne "\n $label\n\t\t" $* + echo -ne "\n $label\n\t\t$help" fi } @@ -100,7 +102,7 @@ _vyatta_op_help () { local cur=$1; shift local node_path=$1; shift - local ndef node_tag_help node_run help + local ndef node_tag_help node_run help last_help ndef=$node_path/node.tag/node.def [ -f $ndef ] && \ @@ -116,7 +118,13 @@ _vyatta_op_help () fi for comp ; do if [ -z "$comp" ] ; then - _vyatta_op_print_help '*' "$node_tag_help" + if [ "X$node_tag_help" == "X$last_help" ] ; then + help="" + else + last_help=$node_tag_help + help=$node_tag_help + fi + _vyatta_op_print_help '*' "$help" elif [[ -z "$cur" || $comp == ${cur}* ]] ; then ndef=$node_path/$comp/node.def if [ -f $ndef ] ; then @@ -124,6 +132,11 @@ _vyatta_op_help () else help=$node_tag_help fi + if [ "X$help" == "X$last_help" ] ; then + help="" + else + last_help=$help + fi _vyatta_op_print_help "$comp" "$help" fi done |