$cmd->run(
$res->command->args['server'],
$res->command->args['user'],
- $res->command->args['key']
+ $res->command->args['key'],
+ $res->command->options['force']
);
break;
+
+ case 'server':
+ $cmd = new Command_Server($this->cfg);
+ $cmd->run($res->command->options['verbose']);
+ break;
+
case 'like':
$this->requireValidHost();
- $cmd = new Command_Like($this->cfg->host);
+ $cmd = new Command_Like($this->cfg);
$cmd->run($res->command->args['url']);
break;
+
+ case 'reply':
+ $this->requireValidHost();
+ $cmd = new Command_Reply($this->cfg);
+ $cmd->run(
+ $res->command->args['url'],
+ implode(' ', $res->command->args['text'])
+ );
+ break;
+
default:
var_dump($this->cfg->host, $res);
Log::err('FIXME');
} else {
$this->cfg->host = $this->cfg->hosts[$key];
}
+ } else {
+ $key = $this->cfg->getDefaultHost();
+ if ($key !== null) {
+ $this->cfg->host = $this->cfg->hosts[$key];
+ }
}
if ($opts['user'] !== null) {
$this->cfg->host->user = $opts['user'];
}
+ $this->cfg->setDebug($opts['debug']);
return $res;
} catch (\Exception $exc) {
'default' => null,
)
);
+ $optParser->addOption(
+ 'debug',
+ array(
+ 'short_name' => '-d',
+ 'long_name' => '--debug',
+ 'description' => 'Verbose output',
+ 'action' => 'StoreTrue',
+ 'default' => false,
+ )
+ );
$cmd = $optParser->addCommand('connect');
+ $cmd->addOption(
+ 'force',
+ array(
+ 'short_name' => '-f',
+ 'long_name' => '--force-update',
+ 'description' => 'Force token update if token already available',
+ 'action' => 'StoreTrue',
+ 'default' => false,
+ )
+ );
$cmd->addArgument(
'server',
[
$cmd->addArgument(
'user',
[
- 'optional' => false,
+ 'optional' => true,
'description' => 'User URL',
]
);
]
);
+ $cmd = $optParser->addCommand('server');
+ $cmd->addOption(
+ 'verbose',
+ array(
+ 'short_name' => '-v',
+ 'long_name' => '--verbose',
+ 'description' => 'Show more server infos',
+ 'action' => 'StoreTrue',
+ 'default' => false,
+ )
+ );
+
//$cmd = $optParser->addCommand('post');
$cmd = $optParser->addCommand('reply');
$cmd->addArgument(
'text',
[
'optional' => false,
+ 'multiple' => true,
'description' => 'Reply text',
]
);
'Server data incomplete. "shpub connect" first.'
);
}
+
+ $this->cfg->host->loadEndpoints();
}
}
?>