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]) |