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 62f824e..44cf8c8 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 c9ebb4d..2ca7d9a 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;
             }
         }
         
             }
         }