From: Christian Weiske Date: Wed, 7 Sep 2016 20:01:44 +0000 (+0200) Subject: use default host if none given X-Git-Tag: v0.0.1^0 X-Git-Url: https://git.cweiske.de/shpub.git/commitdiff_plain/ef34a25776877dbabaf19e36b162698071dd6bd2?ds=sidebyside use default host if none given --- diff --git a/src/shpub/Cli.php b/src/shpub/Cli.php index 62f824e..44cf8c8 100644 --- a/src/shpub/Cli.php +++ b/src/shpub/Cli.php @@ -79,6 +79,11 @@ 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']; diff --git a/src/shpub/Config.php b/src/shpub/Config.php index c9ebb4d..2ca7d9a 100644 --- a/src/shpub/Config.php +++ b/src/shpub/Config.php @@ -88,7 +88,7 @@ class Config } foreach ($this->hosts as $key => $host) { if ($host->default) { - return $host; + return $key; } }