use ANSI color codes on shell by default
authorChristian Weiske <cweiske@cweiske.de>
Thu, 20 Mar 2014 20:27:16 +0000 (21:27 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Thu, 20 Mar 2014 20:27:16 +0000 (21:27 +0100)
src/bdrem/Cli.php
src/bdrem/UserInterface.php

index 0525a37634819c231ab7c769ad6a87e2a056550e..3ecd4ea488b83a4bb003189d1c04e1168a53d8cf 100644 (file)
@@ -40,6 +40,16 @@ class Cli extends UserInterface
         //set default renderer to console
         $parser->options['renderer']->default = 'console';
 
         //set default renderer to console
         $parser->options['renderer']->default = 'console';
 
+        $parser->addOption(
+            'ansi',
+            array(
+                'long_name'   => '--no-color',
+                'description' => 'Do not output ANSI color codes',
+                'action'      => 'StoreFalse',
+                'default'     => true
+            )
+        );
+
         //only on CLI
         $parser->addCommand(
             'readme', array(
         //only on CLI
         $parser->addCommand(
             'readme', array(
index de6d3bbe922d9177318721ad73cb7dfe339fd5ad..66b72e2c9fcfd4227a83de5593aa7a361ef64f19 100644 (file)
@@ -173,6 +173,9 @@ abstract class UserInterface
             $this->config->renderer    = $result->options['renderer'];
             $this->config->stopOnEmpty = $result->options['stopOnEmpty'];
             $this->config->setDate($result->options['date']);
             $this->config->renderer    = $result->options['renderer'];
             $this->config->stopOnEmpty = $result->options['stopOnEmpty'];
             $this->config->setDate($result->options['date']);
+            if (isset($result->options['ansi'])) {
+                $this->config->ansi = $result->options['ansi'];
+            }
             return $result;
         } catch (\Exception $exc) {
             $this->preRenderParameterError();
             return $result;
         } catch (\Exception $exc) {
             $this->preRenderParameterError();