Closed bpatram closed 6 years ago
@bpatram Thanks for putting in all the time for thinking this through.
I will take a look at your PR more closely & ideally get it merged & released around Monday.
@protoEvangelion thanks! To note, my PR is affectively only 50% of what I detailed above which just simply strips away color from the output. It does not add the --format
flag as I discussed. I cannot promise I'll find the time to knock that out before Monday however, but I will try :)
@bpatram We can just merge the --no-color
flag related work and merge --format
related code at a separate time if you would prefer.
@bpatram If you would still like to add the format
flag please open up a new issue as that is a separate feature.
Again thanks for all the work you did for setting up the --no-color
flag.
I think that is going to make peoples' lives a lot easier when trying to parse output!
Hi, I'm running version
1.12.12
and am trying to grab a PR title and author based on a given PR number (viagh pull-request --info ####
). This all works great, however pulling out just the information I need is a bit of a hassle. Since the output is colored there are hidden control characters which makes using regex not so straightforward. Ideally, I would love a way for me to control the output of this function.I have two requests:
git log
to customize the outputHere is my use case:
$ gh pull-request --info 1234
This may output something like this (control characters shown below):
Currently what I have to do is pipe that output to strip those characters:
$ gh pull-request --info 1234 | sed -E "s/[[:cntrl:]]\\[[0-9]{1,3}m//g"
Which works great, then I have to use regex to pull out the PR title and author
Nevertheless, doing all that is exhausting and a bit contrived for such a simple use case.
Proposed Solution:
I would love to be able to do something like the following:
%au: Author Username %s: PR Title/Subject %n: PR number
This would then output:
Of course it would be lovely to be able to compose complex formats, for example:
Which would, in theory, output what is currently output today: