Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pr diff: sanitize control characters for terminal output #7108

Merged
merged 1 commit into from
Mar 8, 2023

Conversation

mislav
Copy link
Contributor

@mislav mislav commented Mar 8, 2023

This avoids printing raw terminal control characters present in a PR diff to the terminal as a result of gh pr diff.

Fixes https://github.com/github/cli/issues/163
Complements #6916

@mislav mislav requested a review from samcoe March 8, 2023 16:01
@mislav mislav requested a review from a team as a code owner March 8, 2023 16:01
@cliAutomation cliAutomation added this to Needs review 🤔 in The GitHub CLI Mar 8, 2023
@mislav mislav merged commit 66cd902 into trunk Mar 8, 2023
The GitHub CLI automation moved this from Needs review 🤔 to Pending Release 🥚 Mar 8, 2023
@mislav mislav deleted the diff-sanitize branch March 8, 2023 16:17
@github-actions github-actions bot moved this from Pending Release 🥚 to Done 💤 in The GitHub CLI Mar 8, 2023
// sanitizer replaces non-printable characters with their printable representations
type sanitizer struct{ transform.NopResetter }

// Transform implements transform.Transformer.
Copy link
Contributor

Choose a reason for hiding this comment

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

TIL about transform.Transformer. I would like to change our other ASCII sanitization code to use this interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
The GitHub CLI
  
Done 💤
Development

Successfully merging this pull request may close these issues.

None yet

2 participants