command_util.sh: Fix man output for templates.
authorAndre Noll <maan@systemlinux.org>
Sun, 23 Sep 2007 20:20:24 +0000 (22:20 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 23 Sep 2007 20:20:24 +0000 (22:20 +0200)
command_util.sh

index a71bb65..62a406c 100755 (executable)
@@ -137,10 +137,29 @@ ${line# }"
 
 dump_man()
 {
-       echo ".SS \"$name_txt\""
-       echo "$desc_txt"
-       echo
-       echo "\\fBusage: \\fP$usage_txt"
+       if test $template -eq 0; then
+               echo ".SS \"$name_txt\""
+               echo "$desc_txt"
+               echo
+               echo "\\fBUsage: \\fP$usage_txt"
+       else
+               for member in $template_members; do
+                       local sed_cmd="sed -e s/@member@/$member/g"
+                       local t_name_txt=$(echo $name_txt | $sed_cmd)
+                       echo ".SS \"$t_name_txt\""
+               done
+               echo "$desc_txt"
+               echo
+               echo "\\fBUsage: \\fP"
+               echo
+               echo ".nf"
+               for member in $template_members; do
+                       local sed_cmd="sed -e s/@member@/$member/g"
+                       local t_usage_txt=$(echo $usage_txt | $sed_cmd)
+                       printf "\t$t_usage_txt\n"
+               done
+               echo ".fi"
+       fi
        echo
        echo "$help_txt"
        echo