X-Git-Url: https://git.cweiske.de/shpub.git/blobdiff_plain/971586c9391e1c6c0b3f6561644d8acd05f3ae8b..ef34a25776877dbabaf19e36b162698071dd6bd2:/src/shpub/Cli.php diff --git a/src/shpub/Cli.php b/src/shpub/Cli.php index 34ef479..44cf8c8 100644 --- a/src/shpub/Cli.php +++ b/src/shpub/Cli.php @@ -35,13 +35,13 @@ class Cli 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->host); + $cmd = new Command_Reply($this->cfg); $cmd->run( $res->command->args['url'], implode(' ', $res->command->args['text']) @@ -79,10 +79,16 @@ class Cli } 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) { @@ -124,6 +130,16 @@ class Cli '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(