Commit 6cf98c8b authored by tandrii@chromium.org's avatar tandrii@chromium.org

git cl try-results: make color force-able.

Inspiration:
  $ watch -n 10 "git cl try-results"
  $ watch --color "ls -al --color"

R=nodir@chromium.org,sergiyb@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1799203002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@299291 0039d316-1c4b-4281-b951-d872f2087c98
parent 5e2a6873
......@@ -453,7 +453,7 @@ def print_tryjobs(options, builds):
def pop(title, f, color=None, **kwargs):
"""Pop matching builds from `builds` dict and print them."""
if not sys.stdout.isatty() or color is None:
if not options.color or color is None:
colorize = str
else:
colorize = lambda x: '%s%s%s' % (color, x, Fore.RESET)
......@@ -3552,7 +3552,10 @@ def CMDtry_results(parser, args):
group.add_option(
"-p", "--patchset", type=int, help="patchset number if not current.")
group.add_option(
"--print-master", action='store_true', help="print master name as well")
"--print-master", action='store_true', help="print master name as well.")
group.add_option(
"--color", action='store_true', default=sys.stdout.isatty(),
help="force color output, useful when piping output.")
group.add_option(
"--buildbucket-host", default='cr-buildbucket.appspot.com',
help="Host of buildbucket. The default host is %default.")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment