]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Respect --no-ansi and disable ansi for non-TTY terminals.
authorepriestley <epriestley@phabricator.com>
Thu, 17 Feb 2011 07:41:03 +0000 (23:41 -0800)
committerepriestley <epriestley@phabricator.com>
Thu, 17 Feb 2011 07:41:03 +0000 (23:41 -0800)
Summary:

Test Plan:

Reviewers:

CC:

scripts/arcanist.php

index 99af52e88ce939f946b91ec34b9403c900ba07a2..83eebff29d98d6a0b62464fd7dad1abfa5ace4e1 100755 (executable)
@@ -40,12 +40,19 @@ foreach ($args as $key => $arg) {
   } else if ($arg == '--trace') {
     unset($args[$key]);
     $config_trace_mode = true;
+  } else if ($arg == '--no-ansi') {
+    unset($args[$key]);
+    PhutilConsoleFormatter::disableANSI(true);
   } else if (preg_match('/^--load-phutil-library=(.*)$/', $arg, $matches)) {
     unset($args[$key]);
     $load['?'] = $matches[1];
   }
 }
 
+if (!posix_isatty(STDOUT)) {
+  PhutilConsoleFormatter::disableANSI(true);
+}
+
 $args = array_values($args);
 
 try {