coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Would a patch adding color to cat(1) be accepted?


From: Eric Pruitt
Subject: Would a patch adding color to cat(1) be accepted?
Date: Sun, 8 Oct 2017 12:31:43 -0700
User-agent: NeoMutt/20170113 (1.7.2)

I am going to modify cat(1) to add an option to embolden and / or color
symbols added by "--show-nonprinting", "--show-ends" and "--show-tabs".
Maintainers, is this a change you would be willing to merge into
Coreutils codebase? I ask because the manner & style I would use to
write a patch intended for my own use would differ from that of a change
intended for upstream, and I would like to avoid writing the patch twice
if there was some hope of it being accepted.

The implementation I currently have in mind would work much like
colorization in ls(1) and grep(1): a "--color" option would be added
that could be set to "always", "never" (default) or "auto"; user-defined
colors would be controlled by the "CAT_COLORS" environment variable
containing escape sequences used to color symbols associated with each
of the aforementioned command line flags; and when "CAT_COLORS" is
unset, the default escape sequence used by all three options would be
simply make the text bold. Using the same two-character convention used
by GREP_COLORS and LS_COLORS, the default value of of "CAT_COLORS" would
be "np=01:nl=01:tb=01"; "np" is short for "non-printing", "nl" is short
for newline a la "--show-ends" and "tb" is short for "tab."

I often find myself using xxd(1) after running "cat -A" to confirm some
characters are what I think they are. With the proposed feature, it
would be easier determine at a glance if certain characters are literal
values that appear in the original data or if they were added by cat(1).

Please let me know what you think,
Eric



reply via email to

[Prev in Thread] Current Thread [Next in Thread]