Skip to content

pr diff: sanitize control characters for terminal output#7108

Merged
mislav merged 1 commit intotrunkfrom
diff-sanitize
Mar 8, 2023
Merged

pr diff: sanitize control characters for terminal output#7108
mislav merged 1 commit intotrunkfrom
diff-sanitize

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
@mislav mislav merged commit 66cd902 into trunk Mar 8, 2023
@mislav mislav deleted the diff-sanitize branch March 8, 2023 16:17
// 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

None yet

Development

Successfully merging this pull request may close these issues.

2 participants