Skip to content

Add ability to force terminal-style output even when redirected#4146

Merged
mislav merged 2 commits intotrunkfrom
force-tty
Aug 23, 2021
Merged

Add ability to force terminal-style output even when redirected#4146
mislav merged 2 commits intotrunkfrom
force-tty

Conversation

@mislav
Copy link
Contributor

@mislav mislav commented Aug 17, 2021

Allows terminal-style output to be piped to a file or a script. Color will be enabled unless explicitly disabled with one of the color-controlling environment variables.

Optionally allows to specify the number of available columns as an absolute number or as a percentage of the current viewport.

Fixes #4035

Example:

GH_FORCE_TTY=49% gh issue list | fzf --ansi --preview 'GH_FORCE_TTY=$FZF_PREVIEW_COLUMNS gh issue view {1}'

Questions:

  • How does the "GH_FORCE_TTY" name sound?

Copy link
Contributor

@vilmibm vilmibm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am cool with the name for this and love the feature; I definitely want some unit tests though since there is subtle logic in how we parse the three forms of the value.

@mislav mislav requested a review from vilmibm August 23, 2021 14:10
@mislav mislav merged commit af2aecd into trunk Aug 23, 2021
@mislav mislav deleted the force-tty branch August 23, 2021 14:46
@aliscco

This comment was marked as spam.

@guilhermeprokisch
Copy link

It's this already in production?

@guilhermeprokisch
Copy link

For me it's only workin with issues and not with prs :/

@mislav
Copy link
Contributor Author

mislav commented Oct 1, 2021

@guilhermeprokisch Yes this is already released. When reporting bugs please include reproduction steps: your gh version, OS, exact command entered, exact output, and your terminal environment. Bonus points if the example lists PRs from a public repo and not private. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No option for forcing styled output (a.k.a. better fzf support)

5 participants