From: Christian Weiske Date: Tue, 6 Sep 2016 22:01:08 +0000 (+0200) Subject: add option to list all configured server connections X-Git-Tag: v0.0.1~9 X-Git-Url: https://git.cweiske.de/shpub.git/commitdiff_plain/97a82467ccfaef7c809b366dbc84ad42afd6f495 add option to list all configured server connections --- diff --git a/src/shpub/Cli.php b/src/shpub/Cli.php index 32dcbe2..a57b287 100644 --- a/src/shpub/Cli.php +++ b/src/shpub/Cli.php @@ -32,6 +32,10 @@ class Cli $cmd = new Command_Like($this->cfg->host); $cmd->run($res->command->args['url']); break; + case 'server': + $cmd = new Command_Server($this->cfg); + $cmd->run($res->command->options['verbose']); + break; default: var_dump($this->cfg->host, $res); Log::err('FIXME'); @@ -142,6 +146,18 @@ class Cli ] ); + $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( diff --git a/src/shpub/Command/Server.php b/src/shpub/Command/Server.php new file mode 100644 index 0000000..59843d4 --- /dev/null +++ b/src/shpub/Command/Server.php @@ -0,0 +1,22 @@ +cfg = $cfg; + } + + public function run($verbose) + { + foreach ($this->cfg->hosts as $key => $host) { + echo $key . "\n"; + if ($verbose) { + echo ' URL: ' . $host->server . "\n"; + echo ' User: ' . $host->user . "\n"; + } + } + } +} +?>