flip but actual answer: pick an ast utility that has a similar a synopsis and do
that-utility --usage
cp(1) and pax(1) come close
but it looks like you have something sccs-like, so maybe not close enough
basically \n\nusage#1 cmd#1 ...\nusage#2 cmd#2 ...\n...\nusage#N cmd#3 ...\n\n
but note that generated docs will produce
there is no way to associate individual options with the corresponding usage
it would be possible to split into N+1 man pages
1 for the man page
foo [ options ] command [ options ] ...
and N, one for each usage#i
foo command#i [ options ] ...
and to get the command#i --man
foo command#i --man
for foo main() would check the command#i operand and use that
to select the appropriate usage_i[] string
On Mon, 14 Apr 2008 16:49:47 +0200 Roland Mainz wrote:
> Is there anywhere an example for a "getopts" usage for a utilty which is
> split into multiple subcommands, e.g. utilty "foo" can be called with
> the subcommand "create", "destroy" etc. (example:
> -- snip --
> foo create [-psjkONBFE] [-b size] [-o property=value] name
> foo destroy [-rRfCXGP] name
> foo add [-rQWERT] name
> foo info
> -- snip --
> ) ... which have widely different usage...
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users