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)
Wed, Dec 18, 8:49 PM
Unknown Object (File)
Sat, Dec 14, 3:03 AM
Unknown Object (File)
Fri, Dec 13, 10:11 PM
Unknown Object (File)
Tue, Dec 10, 8:35 PM
Unknown Object (File)
Sat, Dec 7, 4:40 AM
Unknown Object (File)
Wed, Dec 4, 7:38 AM
Unknown Object (File)
Tue, Dec 3, 5:47 AM
Unknown Object (File)
Tue, Nov 26, 6:50 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.