Page MenuHomePhabricator

Introduce tsprintf(), for escaping terminal output
ClosedPublic

Authored by epriestley on May 21 2015, 3:23 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 11, 9:23 AM
Unknown Object (File)
Tue, Apr 9, 11:09 AM
Unknown Object (File)
Tue, Apr 9, 5:46 AM
Unknown Object (File)
Fri, Apr 5, 11:39 PM
Unknown Object (File)
Sun, Mar 31, 1:07 AM
Unknown Object (File)
Mar 17 2024, 8:20 PM
Unknown Object (File)
Mar 17 2024, 7:28 PM
Unknown Object (File)
Mar 15 2024, 6:42 PM

Details

Summary

Ref T8243. User-controlled strings like task and revision titles may contain terminal control codes which can make text bold and colorful when they shouldn't be at a minimum, and possibly do some worse things in some terminals.

Add tsprintf() for escaping these sorts of strings in order to show them to human viewers.

Test Plan

Added and executed unit tests.

Diff Detail

Repository
rPHU libphutil
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Introduce tsprintf(), for escaping terminal output.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: btrahan.
btrahan edited edge metadata.
This revision is now accepted and ready to land.May 21 2015, 4:32 PM

Hey tsprintf - welcome buddy.

We also have phutil_console_format, which seems somewhat similar.

We also have phutil_console_format, which seems somewhat similar.

Or rather, the distinction between the two is a little unclear.

This revision was automatically updated to reflect the committed changes.