/** * Run the module. * * @param Horde_Cli $cli The CLI handler. * @param mixed $options An array of options. * @param mixed $arguments An array of arguments. * @param array &$world A list of initialized dependencies. * * @return NULL */ public function run($cli, $options, $arguments, &$world) { if (!isset($arguments[1])) { $action = 'display'; } else { $action = $arguments[1]; } switch ($action) { case 'display': $folders = $world['storage']->getList()->getQuery()->listByType('h-ledger'); foreach ($folders as $folder) { $cli->writeln($folder); } break; break; case 'import': $ledger = new Horde_Kolab_Cli_Data_Ledger(); $ledger->importFile($arguments[3]); $data = $world['storage']->getData($arguments[2], 'h-ledger'); $object = array('type' => 'h-ledger'); foreach ($ledger->asXml() as $entry) { $object['xml'] = $entry; $data->create($object); } break; default: $cli->message(sprintf(Horde_Kolab_Cli_Translation::t('Action %s not supported!'), $action), 'cli.error'); break; } }