Add ansi color codes to console output
[bdrem.git] / src / bdrem / Cli.php
1 <?php
2 namespace bdrem;
3
4 class Cli extends UserInterface
5 {
6     protected function loadParameters($cfg)
7     {
8         $params = $GLOBALS['argv'];
9         array_shift($params);
10         $storeInto = null;
11         foreach ($params as $param) {
12             if ($storeInto !== null) {
13                 $cfg->$storeInto = (int)$param;
14                 $storeInto = null;
15                 continue;
16             }
17
18             if ($param == '--days-after' || $param == '-a') {
19                 $storeInto = 'daysAfter';
20                 continue;
21             } else if ($param == '--days-before' || $param == '-b') {
22                 $storeInto = 'daysBefore';
23                 continue;
24             }
25             $storeInto = null;
26         }
27     }
28
29     protected function render($arEvents)
30     {
31         $r = new Renderer_Console();
32         echo $r->render($arEvents);
33     }
34 }
35 ?>