Skip to content

Printing body of issue or PR in plain text #930

@gvela024

Description

@gvela024

Describe the feature or problem you’d like to solve

Hello, as a user, I would like to redirect the output of an issue or PR to a file or other program so that I can use the contents to auto-generate some release notes.

If I do

gh issue view ### > blah.md

The output looks sorta like this (I slightly modified the output, so if some stuff looks strange, don't worry about it.)

Title
Open • gvela024 opened about 28 days ago • 2 comments

Assignees: gvela024
Labels: labels
Milestone: milestone


�[38;5;39;1m�[0m�[38;5;39;1m�[0m  �[38;5;39;1m## �[0m�[38;5;39;1mOverview�...

As you can see above, the �[38;5;39;1m nonsense is my problem. I think either cobra or glamour is making the characters special for bash...I'm kinda ignorant in the ways of bash and Go so be gentle 🙏.

Proposed solution

Gimme the plain text. It'd be cool if I could do

gh issue view ### --plain-text

or similar.

Going through it looks like the out IO writer could be changed globally to do plain text instead of using the pretty printers. Or, could make special cases for all the prints which feels wrong.

How will it benefit CLI and its users?
As mentioned above, I want to take some of the issues' text and use it to generate release notes for my project.

Additional context

None

Add any other context like screenshots or mockups are helpful, if applicable.
I kinda tried to see if I could change the thing that wrote commands based on another arg, but it looks like args are handled by sub commands. So it seems like the additional arg would have to be handled by anything that prints. I went down a bit of a rabbit hole due to being unfamiliar with Go.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLI

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions