pick any ast command that uses optget() or script that uses getopts
and this will give the usage string

        ast-command --usage

if you have the ast fmt(1) command (from the ast-open package)
then use the -o option to format the usage

        fmt --usage 2>&1 | fmt -o

the ast ls(1) command exercises most of the optget/getopts features

        ls --usage 2>&1 | fmt -o

you can stuff this into a ksh script for testing with getopts

        astcmd=ls
        {
                print -r $'USAGE=$\''
                $astcmd '--??usage' 2>&1 | fmt -o
                print $'\n\'\ngetopts -a '$astcmd$' "$USAGE" OPT'
        } > test-$astcmd
        chmod +x test-$astcmd
        test-$astcmd --man


On Sun, 7 Feb 2010 20:10:44 -0800 Eric Peterson wrote:
> Yes, I am use $'…' to quote.  Trying various ways, I get the following.  I 
> must be staring at this too much.  I've been trying to search for examples, 
> but there aren't many that use this format.  Most getopts example use the 
> simpler form getops ":fd:h" and don't mess with the man page.  I've been 
> asked to write some apps that I will not be running, so I want to give as 
> much help as I can.  

_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to