Subject: [bug#72536] [PATCH] tap: new `--merge-prefix' option to prefix stderr before merging

From: Richard Hansen <[email-masked]>
Date: Sat, 10 Aug 2024 02:55:00 -0400

On 2024-08-09 22:47:32-04:00, Jacob Bachmeyer wrote:
> I would suggest `--label-stderr' or `--stderr-message-prefix' as better 
> option names to open a discussion.  The main problem I see with 
> `--merge-prefix' is that it is using "merge" in a sense that can only be 
> understood with the detailed context of what the TAP driver does.

Good point.  How about `--stderr-prefix`?  The downside to not including 
"merge" in the option name is that it isn't obviously tied to the 
`--merge` option.

I could make this option independent of `--merge` and always prefix each 
line of the test script's stderr.  That would make it easier for users 
to understand the option's behavior, even if it would rarely be used 
without `--merge`.

Or I could change it to something like `--merge-with-prefix` and have it 
automatically turn on `--merge`.

On a separate note, it's difficult to portably add a `#` character to a 
make variable, as you can see in the test I added.  Yet that is the one 
character that users will almost certainly want to include in the 
prefix.  I wonder if this should have a default prefix so that users 
don't have to figure out how to pass `#`.  Maybe something like:

   * `--stderr-prefix` by itself to prefix with the default of `# `
   * `--stderr-prefix custom-prefix` to prefix with `custom-prefix`

This would be a bit more complicated to implement because the script 
would need a heuristic to determine whether the user passed a custom 
prefix or not (such as, "there is an argument after `--stderr-prefix` 
and that argument does not begin with `-`").

-Richard

p.s. I requested a copyright assignment form.