summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorTom Grennan <tgrennan@vyatta.com>2007-10-02 15:06:32 -0700
committerTom Grennan <tgrennan@vyatta.com>2007-10-02 15:06:32 -0700
commit3b5d8b0964eb27224065155d4d55a48040db8b12 (patch)
tree19f73037049f2399489f9ffa14b2a1fec20b12fb /etc
parentd4558246bbcd4dfc67487c6a835383d3f975a5a2 (diff)
downloadvyatta-op-3b5d8b0964eb27224065155d4d55a48040db8b12.tar.gz
vyatta-op-3b5d8b0964eb27224065155d4d55a48040db8b12.zip
beautify help message with extra long completion tags
Diffstat (limited to 'etc')
-rw-r--r--etc/bash_completion.d/vyatta-op10
1 files changed, 7 insertions, 3 deletions
diff --git a/etc/bash_completion.d/vyatta-op b/etc/bash_completion.d/vyatta-op
index 41439ea..ec309f0 100644
--- a/etc/bash_completion.d/vyatta-op
+++ b/etc/bash_completion.d/vyatta-op
@@ -218,13 +218,17 @@ _vyatta_op_print_help ()
{
local -a comps=()
local -a helps=()
+ local -i taglen=12
eval "comps=( \"\${$1[@]}\" )"
eval "helps=( \"\${$2[@]}\" )"
- local idx=0
echo -en "\nPossible completions:"
- for (( idx = 0 ; idx < ${#comps[@]} ; idx++ )); do
- printf "\n %-12s ${helps[$idx]}" ${comps[$idx]}
+ for (( idx = 0 ; idx < ${#comps[@]} ; idx++ )) ; do
+ if [ ${#comps[idx]} -lt $taglen ] ; then
+ printf "\n %-${taglen}s\t${helps[idx]}" ${comps[idx]}
+ else
+ printf "\n %s\n\t\t${helps[idx]}" ${comps[idx]}
+ fi
done
}