From 3b5d8b0964eb27224065155d4d55a48040db8b12 Mon Sep 17 00:00:00 2001 From: Tom Grennan Date: Tue, 2 Oct 2007 15:06:32 -0700 Subject: beautify help message with extra long completion tags --- etc/bash_completion.d/vyatta-op | 10 +++++++--- 1 file 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 } -- cgit v1.2.3