use console_commandline for parameter parsing
[bdrem.git] / src / bdrem / Cli.php
index 21991610cf2dfcbe696dbe8a025d8f34f6a193d7..ec849f42cac05f8267326ed1c8d9efc52a8c2eef 100644 (file)
@@ -5,33 +5,11 @@ class Cli extends UserInterface
 {
     protected function loadParameters()
     {
-        $params = $GLOBALS['argv'];
-        array_shift($params);
-        $storeInto = null;
-        foreach ($params as $param) {
-            if ($storeInto !== null) {
-                $this->config->$storeInto = (int)$param;
-                $storeInto = null;
-                continue;
-            }
+        $parser = parent::loadParameters();
+        //set default renderer to console
+        $parser->options['renderer']->default = 'console';
 
-            if ($param == '--days-after' || $param == '-a') {
-                $storeInto = 'daysAfter';
-                continue;
-            } else if ($param == '--days-before' || $param == '-b') {
-                $storeInto = 'daysBefore';
-                continue;
-            }
-            $storeInto = null;
-        }
-    }
-
-    protected function render($arEvents)
-    {
-        $r = new Renderer_Mail();
-        $r->config = $this->config;
-        $r->ansi = true;
-        echo $r->render($arEvents);
+        return $parser;
     }
 }
 ?>