From bc9759b68314aa88ac5503384cf8f92ae0cc4221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn?= Date: Thu, 6 Aug 2020 18:27:25 +0200 Subject: [PATCH] adding #22 --- app/Commands/NginxVhostsCommand.php | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/app/Commands/NginxVhostsCommand.php b/app/Commands/NginxVhostsCommand.php index e28e3b0..549b38c 100644 --- a/app/Commands/NginxVhostsCommand.php +++ b/app/Commands/NginxVhostsCommand.php @@ -131,7 +131,14 @@ class NginxVhostsCommand extends Command // input domain ->addItem('domain: -', function(CliMenu $menu) use (&$configuration) { - $result = $menu->askText()->ask(); + + $input = $menu->askText(); + + if ($configuration['domain']) { + $input->setPlaceholderText($configuration['domain']); + } + + $result = $input->ask(); $configuration['domain'] = $result->fetch(); $menu->getSelectedItem()->setText('domain: '.$result->fetch()); @@ -140,7 +147,14 @@ class NginxVhostsCommand extends Command // input root ->addItem('root: -', function(CliMenu $menu) use (&$configuration) { - $result = $menu->askText()->ask(); + + $input = $menu->askText(); + + if ($configuration['root']) { + $input->setPlaceholderText($configuration['root']); + } + + $result = $input->ask(); $configuration['root'] = $result->fetch(); $menu->getSelectedItem()->setText('root: '.$result->fetch()); @@ -149,7 +163,14 @@ class NginxVhostsCommand extends Command // input index ->addItem('index: '.$configuration['index'], function(CliMenu $menu) use (&$configuration) { - $result = $menu->askText()->ask(); + + $input = $menu->askText(); + + if ($configuration['index']) { + $input->setPlaceholderText($configuration['index']); + } + + $result = $input->ask(); $configuration['index'] = $result->fetch(); $menu->getSelectedItem()->setText('index: '.$result->fetch()); @@ -204,7 +225,7 @@ class NginxVhostsCommand extends Command $bladeFile->put($template['name'], '/etc/nginx/sites-available/'.$filename, $configuration); $menu->confirm('Success!')->display('Ok!'); - // invoke action + // invoke action $action = new NginxVhostGoBackAction(); is_callable($action($menu)); }