|
From: | Jerome Fisher |
Subject: | Re: [Monotone-devel] monotone automate stdio |
Date: | Wed, 18 May 2005 23:14:02 +0200 |
User-agent: | Mozilla Thunderbird 1.0.2 (Windows/20050317) |
Timothy Brownawell wrote:
On 5/15/05, Joel Crisp <address@hidden> wrote:Hi Just a small comment; maybe a format using the numeric prefix familiar to us all from RFCs like 200 OK UNKNOWN test/foo 201 foo.h 201 foo.c etc. This format is more likely to be parsable with existing libraries and is familiar to people who have worked with other software.I don't entirely get what you're saying. You mean put a number at the beginning of *each* line? I'm not sure that's even doable without changes to all the automate commands. The reasoning behind how I set it up is to separate the output of the various commands. There *needs* to be an end delimiter of some sort, and it's probably good to have a start delimiter as well. My choice of delimiters was purely arbitrary. I'm not sure it's possible to edit the actual output of the commands, just to put stuff between them. Also, not editing lets it be handled almost exactly the same way as the individual commands were; just scan the output for the delimiters and send the lines to whatever would have parsed that output. No need to strip line prefixes or anything.
This strikes me as bad for the obvious reason that the delimiters appearing in the command output would mess things up. You'd need to ensure that user data (such as filenames, cert keys and values, cats and diffs) are never inserted in such a way that they could be considered a delimiter. From the top of my head, you could either: 1) Have a method for escaping delimiters when they literally appear in the command output. 2.a) Have all command output in a format that is always distinguishable from non-command output (such as Joel proposed). 2.b) Have user data in a format that is always distinguishable from non-command output. 3) Before the command output, specify how many bytes or lines the command output is going to be. 4) Use stdout for command output and stderr for non-command output. I don't really have an opinion on what should be used, as long as it isn't a format that relies heavily on luck. Regards, Jerome
[Prev in Thread] | Current Thread | [Next in Thread] |