예제 #1
0
파일: hc.php 프로젝트: niieani/napkin
$cmd['chuser']->addArgument('username', array('description' => 'TODO', 'optional' => TRUE));
//drop
$cmd['drop'] = $parser->addCommand('drop', array('description' => 'drops the database', 'aliases' => array('dropdb')));
$cmd['drop']->addArgument('database', array('description' => 'database to be dropped'));
//rename
$cmd['rename'] = $parser->addCommand('rename', array('description' => 'renames a website or a user', 'aliases' => array('ren')));
$cmd['rename']->addArgument('oldname', array('description' => 'current name of website or username'));
$cmd['rename']->addArgument('newname', array('description' => 'the desired new name'));
//remove
$cmd['remove'] = $parser->addCommand('remove', array('description' => 'removes a website or user', 'aliases' => array('rm')));
$cmd['remove']->addArgument('name', array('description' => 'current name of website or username'));
//debug
$cmd['debug'] = $parser->addCommand('debug', array('description' => 'TODO'));
// run the parser
try {
    $result = $parser->parse();
    if ($result->options) {
        //if ($result->options['verbose'] === true) LogCLI::SetVerboseLevel(2);
        LogCLI::SetVerboseLevel($result->options['verbose']);
        //else LogCLI::SetVerboseLevel(1);
    }
    LogCLI::Message(LogCLI::GREEN . 'Running the HypoConf engine...' . LogCLI::RESET, 2);
    if ($result->command_name) {
        switch ($result->command_name) {
            case 'debug':
                LogCLI::Message(LogCLI::BLUE . 'Sorry, not implemented yet... :-D' . LogCLI::RESET, 1);
                break;
            case 'help':
                displayHelp($result->command->args['setting']);
                break;
            case 'set':