[texdoc] texdoc machine readable output

Adam R. Maxwell amaxwell at mac.com
Fri Nov 13 06:40:41 CET 2009


Hi Manuel,

On Nov 11, 2009, at 9:48 AM, Manuel Pégourié-Gonnard wrote:

> For your information, I just added an option to texdoc allowing to
> select more machine-friendly output. The command-line option is -M or
> --machine.
> 
> The new output format is as follows:
> - If only one argument was given, then each line of output is exactly
> one file name.

Thanks very much for letting me know; I finally got around to testing a git snapshot this evening, and this is great.  Not having to make assumptions about the output format always make me happier :).  Right now I only parse a line if it has a leading digit, and assume everything following is a path.

> - If more arguments were given, a line <tab>name is inserted before each
> argument's result list.

This sounds fine, although I don't pass multiple args at present.  I wonder if it would be more straightforward to parse if the output was tab-delimited columns?  So instead of

	foo
/path/a
/path/b
	bar
/path/c
/path/d

maybe more like tlmgr's machine-readable output

foo	/path/a
foo	/path/b
bar	/path/c
bar	/path/d

Also, if the name were always inserted, the output parsing would the same regardless of how many args were passed.  Just an idea...as I said, I'm only passing a single argument.  

> I also reworked the exit codes, which are now:
> - 0: process exited normally (even if problems were encountered, like
> unable to launch a viewer, no result found,  etc)
> - 1: internal error (lua's error() or assert() functions). Please note
> that in this case the error message is written on stdout, not stderr.
> - 2: usage error.

Thank you, that's also helpful to know, especially the second point; I can tighten up my error handling code in that case.

I followed the instructions at http://tug.org/texdoc/dev/ for switching using the td-switch wrapper (nice).  The only hitch was that I needed to create TEXMFHOME/scripts and TEXMFHOME/texdoc manually.  Not hard, but maybe worth noting.

regards,
Adam

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2415 bytes
Desc: not available
URL: <http://tug.org/mailman/private/texdoc/attachments/20091112/c9e519aa/attachment.bin>


More information about the texdoc mailing list