use console_commandline for parameter parsing
[bdrem.git] / src / bdrem / Cli.php
index c38e1735f06721b8fac1944e500d48294e8aedc7..ec849f42cac05f8267326ed1c8d9efc52a8c2eef 100644 (file)
@@ -3,33 +3,13 @@ namespace bdrem;
 
 class Cli extends UserInterface
 {
-    protected function loadParameters($cfg)
+    protected function loadParameters()
     {
-        $params = $GLOBALS['argv'];
-        array_shift($params);
-        $storeInto = null;
-        foreach ($params as $param) {
-            if ($storeInto !== null) {
-                $cfg->$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_Console();
-        echo $r->render($arEvents);
+        return $parser;
     }
 }
 ?>