Oddly enough, 'dot' almost has this feature, but the helpful output
itself is currently tricky to parse and list.
Model example; 'mplayer':
mplayer -vo help | tail
mpegpes MPEG-PES to DVB card
yuv4mpeg yuv4mpeg output for mjpegtools
png PNG file
jpeg JPEG file
gif89a animated GIF output
tga Targa output
pnm PPM/PGM/PGMYUV file
md5sum md5sum of each frame
112 audio & 235 video codecs
'man dot' asks users to guess & poll, or go online:
% man dot | grep -A 17 "OUTPUT FORMATS"
OUTPUT FORMATS
Dot uses an extensible plugin mechanism for its output renderers,
so to see what output formats your installation of dot supports you
can use ``dot -Txxx'' (where xxx is an unlikely format) and check
the warning message. Also, The plugin mechanism supports multiple
implementations of the output formats. To see what variants are
available, use, for example: ``dot -Tpng:'' and to force a particu-
lar variant, use, for example: ``dot -Tpng:gd''
Traditionally, dot supports the following: -Tps (PostScript), -Tsvg
-Tsvgz (Structured Vector Graphics), -Tfig (XFIG graphics), -Tmif
(FrameMaker graphics), -Thpgl (HP pen plotters), and -Tpcl (Laser-
jet printers), -Tpng -Tgif (bitmap graphics), -Tdia (GTK+ based
diagrams), -Timap (imagemap files for httpd servers for each node
or edge that has a non(hynull "href" attribute.), -Tcmapx (client-
side imagemap for use in html and xhtml). Additional less common
or more special-purpose output formats can be found at
http://www.graphviz.org/cvs/doc/info/output.html.)
(Bonus: if an 'mplayer'-like '-T help' option were added, most of those
two paragraphs won't be needed.)
When testing what the 'man' says, the user is surprised to find that
"the warning message" is close what a '-T help' option should be:
# there's no 'help' graphics format, so try that...
% dot -T help
Format: "help" not recognized. Use one of: canon cmap cmapx
cmapx_np dia dot eps fig gd gd2 gif hpgl imap imap_np ismap
jpe jpeg jpg mif mp pcl pdf pic plain plain-ext png ps ps2
svg svgz tk vml vmlz vrml vtx wbmp xdot xlib
The above listing is incomplete; subtypes exist:
# show help for 'png'
dot -Tpng:
Format: "png:" not recognized. Use one of: png:cairo:cairo
png:cairo:gd png:gd:gd
More than one format followed by only a colon (e.g. 'dia:') make 'dot'
wait for input, (another bug?), so getting a complete list is a kludgy
business. Until something better comes along, here's one way to do it:
# parse '-T' error from stderr, mine that for suboptions,
# ending needless processes as they occur.
% for f in $(dot -T help 2>&1 | sed 's/.*://') ;
do echo "Format: $f" ;
dot -T$f: & n=$! ;
sleep .1s ; kill -9 $n ;
done 2>&1 | grep Format | sed 's/.*: //g;s/ /\n/g'
On my system it shows 80 items. Anyway, the 'mplayer -vo help' style
would be better.
HTH...