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 0525a37..3ecd4ea 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 de6d3bb..66b72e2 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();