add microformats2 markup to html table
[bdrem.git] / src / bdrem / Cli.php
index f108e8e4b8b48cff5567458051538c172054bac0..3ecd4ea488b83a4bb003189d1c04e1168a53d8cf 100644 (file)
@@ -1,14 +1,55 @@
 <?php
+/**
+ * Part of bdrem
+ *
+ * PHP version 5
+ *
+ * @category  Tools
+ * @package   Bdrem
+ * @author    Christian Weiske <cweiske@cweiske.de>
+ * @copyright 2014 Christian Weiske
+ * @license   http://www.gnu.org/licenses/agpl.html GNU AGPL v3
+ * @link      http://cweiske.de/bdrem.htm
+ */
 namespace bdrem;
 
+/**
+ * Command line user interface for the terminal/shell.
+ * Renders an ASCII table by default.
+ *
+ * @category  Tools
+ * @package   Bdrem
+ * @author    Christian Weiske <cweiske@cweiske.de>
+ * @copyright 2014 Christian Weiske
+ * @license   http://www.gnu.org/licenses/agpl.html GNU AGPL v3
+ * @version   Release: @package_version@
+ * @link      http://cweiske.de/bdrem.htm
+ */
 class Cli extends UserInterface
 {
+    /**
+     * Load parameters for the CLI option parser.
+     * Set the default renderer to "console" and adds some CLI-only commands
+     * like "readme" and "config".
+     *
+     * @return \Console_CommandLine CLI option parser
+     */
     protected function loadParameters()
     {
         $parser = parent::loadParameters();
         //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(
@@ -24,6 +65,13 @@ class Cli extends UserInterface
         return $parser;
     }
 
+    /**
+     * Handle any commands given on the CLI
+     *
+     * @param object $res Command line parameters and options
+     *
+     * @return void
+     */
     protected function handleCommands($res)
     {
         if ($res->command_name == '') {
@@ -37,12 +85,22 @@ class Cli extends UserInterface
         }
     }
 
+    /**
+     * Handle the "readme" command and output the readme.
+     *
+     * @return void
+     */
     protected function showReadme()
     {
         readfile(__DIR__ . '/../../README.rst');
         exit();
     }
 
+    /**
+     * Handle the "config" command and output the default configuration
+     *
+     * @return void
+     */
     protected function extractConfig()
     {
         readfile(__DIR__ . '/../../data/bdrem.config.php.dist');