git-bug
git-bug copied to clipboard
Update the output of `ls` so that it's machine parseable
While working on #828, I found that the output of the ls
command could be improved. The default
value of OutputFormat
produces the following output (only one bug shown):
7daec5d open\tthis is a bug title \tJohn Doe \t\n
This output is almost TSV compatible but would require that the space following the hash prefix be replaced by a tab. For a human, any shell with a tab size of 2, 4 or 8 characters would still result in the output being displayed with a single space after when viewed. It would however make machine processing of the output much simpler.
This issue would involve analyzing (and updating where needed) the following OutputFormat
s:
- [ ] org-mode
- [ ] plain
- [ ] json
- [ ] compact
- [ ] default
@MichaelMure - If this makes sense, please assign it to me and I'll take care of it before finishing #828.
After looking through the code for the ls
formatting functions, I realized that a) the org-mode
and json
formatters already provide machine parseable output and b) we really only need one of the three text output formatters to be "regular". Since the default
formatter is already using tabs for most of its field separators, changing that format makes the most sense.
Using the default
formatter for field-oriented operations has an additional side effect as you can simple type git but ls
without having to specify a formatter - e.g. git bug ls -f compact
. One caveat is that the label indicators are still right-aligned in the same field as the title. We may want to change this in the future.