Control: tags -1 +pending
Control: found -1 1.2.0
On 2018-02-27 09:37:03, Paul Wise wrote:
> On Mon, 2018-02-26 at 20:31 -0500, Antoine Beaupré wrote:
>
>> Why can't you use --no-colors here?
>
> I definitely can, but I should not have to. The convention for tools
> that use colour is to gate that on isatty, undertime should do that.
ooookaaaay, i'll fix the damn thing. :)
in the meantime, you can apply this on top of 1.2.0.
>From 7c69544fc2c6a266ff5a4163242db15f8b3c58ae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= <[email protected]>
Date: Tue, 27 Feb 2018 10:05:08 -0500
Subject: [PATCH] do not output colors outside of terminals (Closes: #891381)
Finally acquiese to pabs' arguments that a piped program shouldn't
produce escape sequences. My argument was that --no-colors could be
used to fix the behavior, but it's true that the proper behavior by
default would be better, and we can always force colors with --colors
thanks to my shiny NegateAction (I *KNEW* this would be useful
eventually).
---
undertime | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/undertime b/undertime
index e22fae4..9f1c352 100755
--- a/undertime
+++ b/undertime
@@ -33,6 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import argparse
import datetime
import logging
+import sys
# also considered colorama and crayons
# 1. colorama requires to send reset codes. annoying.
@@ -97,7 +98,7 @@ def arg_parser():
help='end of working day, in hours [default: %(default)s]')
parser.add_argument('--date', '-d', default=None, metavar='WHEN',
help='target date for the meeting, supports arbitrary dates like "in two weeks" [default: now]')
- parser.add_argument('--colors', '--no-colors', action=NegateAction,
+ parser.add_argument('--colors', '--no-colors', action=NegateAction, default=sys.stdout.isatty(),
help='show colors [default: %(default)s]')
parser.add_argument('--default-zone', '--no-default-zone', action=NegateAction,
help='show current timezone first [default: %(default)s]')
--
2.11.0
not sure i want to roll yet another trivial release just for this, do
you mind if i wait for other/more bug reports first?
a.
--
My passionate sense of social justice and social responsibility has
always contrasted oddly with my pronounced lack of need for direct
contact with other human beings and communities. I am truly a "lone
traveler" and have never belonged to my country, my home, my friends,
or even my immediate family, with my whole heart; in the face of all
these ties, I have never lost a sense of distance and a need for
solitude.
- Albert Einstein