use default host if none given v0.0.1
authorChristian Weiske <cweiske@cweiske.de>
Wed, 7 Sep 2016 20:01:44 +0000 (22:01 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Wed, 7 Sep 2016 20:01:44 +0000 (22:01 +0200)
src/shpub/Cli.php
src/shpub/Config.php

index 62f824ee92546455cb309219983b63372d4f3ee1..44cf8c86744ecaf7b149a1b3039cd3026ed4b69e 100644 (file)
@@ -79,6 +79,11 @@ class Cli
                 } else {
                     $this->cfg->host = $this->cfg->hosts[$key];
                 }
                 } 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'];
             }
             if ($opts['user'] !== null) {
                 $this->cfg->host->user = $opts['user'];
index c9ebb4d783655e1d1544286be2b86f47a5b612fd..2ca7d9adeea3c376196ebe0972fd313d53879ba0 100644 (file)
@@ -88,7 +88,7 @@ class Config
         }
         foreach ($this->hosts as $key => $host) {
             if ($host->default) {
         }
         foreach ($this->hosts as $key => $host) {
             if ($host->default) {
-                return $host;
+                return $key;
             }
         }
         
             }
         }