diff --git a/src/ServerList.php b/src/ServerList.php
index 7a1bac1..14e5e17 100644
--- a/src/ServerList.php
+++ b/src/ServerList.php
@@ -37,7 +37,6 @@ public function execute( InputInterface $input, OutputInterface $output): int
{
$this->title();
- render('
Here\'s a list of all saved servers.
');
(new Configurator())->list();
return 0;
diff --git a/src/Services/Configurator.php b/src/Services/Configurator.php
index 4d6b1a2..c888e3f 100644
--- a/src/Services/Configurator.php
+++ b/src/Services/Configurator.php
@@ -40,6 +40,8 @@ public function list()
{
$counter = 1;
if (isset($this->getConfig()['servers'])) {
+ render('Here\'s a list of all saved servers.
');
+
collect($this->getConfig()['servers'])->each(function ($server) use (&$counter) {
render("{$counter}. {$server['name']} ({$server['host']})");
$counter++;
diff --git a/src/Traits/HasServer.php b/src/Traits/HasServer.php
index 72fcdc4..540a91d 100644
--- a/src/Traits/HasServer.php
+++ b/src/Traits/HasServer.php
@@ -5,12 +5,15 @@
trait HasServer
{
- public function getServers($configurator){
+ public function getServers($configurator)
+ {
$ret = [];
- $counter = 1;
- foreach($configurator->getConfig()['servers'] as $key => $server){
- $ret[$counter] = $server['name'];
- $counter++;
+ if (isset($configurator->getConfig()['servers'])) {
+ $counter = 1;
+ foreach ($configurator->getConfig()['servers'] as $key => $server) {
+ $ret[$counter] = $server['name'];
+ $counter++;
+ }
}
return $ret;
}