- p'
- echo
- echo "# Try $gsu_name help <command> for info on <command>."
- ret=$GSU_SUCCESS
- return
- fi
- if test "$1" = "help"; then
- echo "$_gsu_help_txt"
- ret=$GSU_SUCCESS
- return
- fi
- if test "$1" = "man"; then
- echo "$_gsu_man_txt"
+ p
+ ' | {
+ local -a cmds=() descs=()
+ local -i i maxlen=1
+ local cmd desc
+ while read cmd desc; do
+ ((maxlen < ${#cmd})) && maxlen=${#cmd}
+ cmds[${#cmds[@]}]=$cmd
+ descs[${#descs[@]}]=$desc
+ done
+ for ((i = 0; i < ${#cmds[@]}; i++)); do
+ printf '%-*s %s\n' $maxlen ${cmds[$i]} \
+ "${descs[$i]}"
+ done
+ }
+ printf "\n# Try %s help <command> for info on <command>, or %s help -a to see\n" \
+ "$gsu_name" "$gsu_name"
+ printf '# also the subcommands which are automatically generated by gsu.\n'