Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(356)

Unified Diff: gclient.py

Issue 8371006: Reapply r106708 "Include initial use of colorama" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pylintrc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient.py
diff --git a/gclient.py b/gclient.py
index 8a848cf20b9a082e634cfb8cf747903cbc6c99e3..e29eaa80c0fa51bddd3792ba7f141e0382bd61fe 100644
--- a/gclient.py
+++ b/gclient.py
@@ -69,6 +69,9 @@ import gclient_scm
import gclient_utils
from third_party.repo.progress import Progress
import subprocess2
+from third_party import colorama
+# Import shortcut.
+from third_party.colorama import Fore
def attr(attribute, data):
@@ -1483,6 +1486,7 @@ def Main(argv):
if sys.hexversion < 0x02050000:
print >> sys.stderr, (
'\nYour python version is unsupported, please upgrade.\n')
+ colorama.init()
try:
# Make stdout auto-flush so buildbot doesn't kill us during lengthy
# operations. Python as a strong tendency to buffer sys.stdout.
@@ -1492,9 +1496,14 @@ def Main(argv):
# Do it late so all commands are listed.
# Unused variable 'usage'
# pylint: disable=W0612
- CMDhelp.usage = ('\n\nCommands are:\n' + '\n'.join([
- ' %-10s %s' % (fn[3:], Command(fn[3:]).__doc__.split('\n')[0].strip())
- for fn in dir(sys.modules[__name__]) if fn.startswith('CMD')]))
+ def to_str(fn):
+ return (
+ ' %s%-10s%s' % (Fore.GREEN, fn[3:], Fore.RESET) +
+ ' %s' % Command(fn[3:]).__doc__.split('\n')[0].strip())
+ cmds = (
+ to_str(fn) for fn in dir(sys.modules[__name__]) if fn.startswith('CMD')
+ )
+ CMDhelp.usage = '\n\nCommands are:\n' + '\n'.join(cmds)
parser = Parser()
if argv:
command = Command(argv[0])
« no previous file with comments | « no previous file | pylintrc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698