commands to show readme and extract config template
[bdrem.git] / src / bdrem / UserInterface.php
index 8fa001ffcb81b5093b50082ea43b28ac20e13ca4..4e27d5da12715475e61e2d6ed0c5509965e785be 100644 (file)
@@ -13,7 +13,8 @@ abstract class UserInterface
             setlocale(LC_TIME, $this->config->locale);
 
             $parser = $this->loadParameters();
-            $this->parseParameters($parser);
+            $res = $this->parseParameters($parser);
+            $this->handleCommands($res);
 
             if (!$this->config->cfgFileExists) {
                 throw new \Exception('No config file found');
@@ -97,15 +98,6 @@ abstract class UserInterface
                 'action'      => 'StoreString'
             )
         );
-        $parser->addOption(
-            'quiet',
-            array(
-                'short_name'  => '-q',
-                'long_name'   => '--quiet',
-                'description' => "Don't print status messages to stdout",
-                'action'      => 'StoreTrue'
-            )
-        );
         return $parser;
     }
 
@@ -117,9 +109,9 @@ abstract class UserInterface
             $this->config->daysNext    = $result->options['daysNext'];
             $this->config->daysPrev    = $result->options['daysPrev'];
             $this->config->renderer    = $result->options['renderer'];
-            $this->config->quiet       = $result->options['quiet'];
             $this->config->stopOnEmpty = $result->options['stopOnEmpty'];
             $this->config->setDate($result->options['date']);
+            return $result;
         } catch (\Exception $exc) {
             $this->preRenderParameterError();
             $parser->displayError($exc->getMessage());
@@ -148,6 +140,10 @@ abstract class UserInterface
         return new $class();
     }
 
+    protected function handleCommands($res)
+    {
+    }
+
     protected function preRenderParameterError()
     {
     }