- if ($param == '--days-after' || $param == '-a') {
- $storeInto = 'daysAfter';
- continue;
- } else if ($param == '--days-before' || $param == '-b') {
- $storeInto = 'daysBefore';
- continue;
- }
- $storeInto = null;
+ $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(
+ 'description' => 'Show README.rst file'
+ )
+ );
+ $parser->addCommand(
+ 'config', array(
+ 'description' => 'Extract configuration file'
+ )
+ );
+
+ 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 == '') {
+ return;
+ } else if ($res->command_name == 'readme') {
+ $this->showReadme();
+ } else if ($res->command_name == 'config') {
+ $this->extractConfig();
+ } else {
+ throw new \Exception('Unknown command');