X-Git-Url: https://git.cweiske.de/bdrem.git/blobdiff_plain/6032c11d7a88651d85154ffe835a26b3f569c893..5c88f5e19a69485da44e132e0b102b835eee7f05:/src/bdrem/UserInterface.php diff --git a/src/bdrem/UserInterface.php b/src/bdrem/UserInterface.php index de6d3bb..8a25bf4 100644 --- a/src/bdrem/UserInterface.php +++ b/src/bdrem/UserInterface.php @@ -45,6 +45,9 @@ abstract class UserInterface $res = $this->parseParameters($parser); $this->config->load(); + setlocale(LC_TIME, $this->config->locale); + $this->handleCommands($res); + if (!$this->config->cfgFileExists) { throw new \Exception( "No config file found. Looked at the following places:\n" @@ -52,9 +55,6 @@ abstract class UserInterface ); } - setlocale(LC_TIME, $this->config->locale); - $this->handleCommands($res); - $source = $this->config->loadSource(); $arEvents = $source->getEvents( $this->config->date, @@ -78,7 +78,7 @@ abstract class UserInterface { $parser = new \Console_CommandLine(); $parser->description = 'Birthday reminder'; - $parser->version = '0.1.0'; + $parser->version = '0.6.0'; $parser->addOption( 'daysNext', @@ -113,6 +113,7 @@ abstract class UserInterface 'console', 'html', 'htmltable', + 'ical', 'mail', ), 'default' => 'console', @@ -148,6 +149,14 @@ abstract class UserInterface 'action' => 'StoreString' ) ); + $parser->addOption( + 'debug', + array( + 'long_name' => '--debug', + 'description' => 'Development helper (mail)', + 'action' => 'StoreTrue' + ) + ); return $parser; } @@ -170,9 +179,13 @@ abstract class UserInterface $this->config->daysNext = $result->options['daysNext']; $this->config->daysPrev = $result->options['daysPrev']; + $this->config->debug = $result->options['debug']; $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();