Skip to content

Commit

Permalink
Switches logic in setup to prevent asking questions twice.
Browse files Browse the repository at this point in the history
  • Loading branch information
typhonius committed Nov 20, 2020
1 parent ba11b3b commit 9f5d128
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/Commands/SetupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,14 @@ public function setup(Config $config)
foreach ($configFiles as $type => $location) {
$this->yell(sprintf('%s configuration (%s)', ucfirst($type), $location));

if (
file_exists($location) && $this->confirm(
sprintf('Would you like to regenerate the %s configuration file', $type)
)
) {
$this->createConfigYaml($location);
} elseif (
$this->confirm(
sprintf('%s configuration file not found. Would you like to add one?', ucfirst($type))
)
) {
$this->createConfigYaml($location);
if (file_exists($location)) {
if ($this->confirm(sprintf('Would you like to regenerate the %s configuration file', $type))) {
$this->createConfigYaml($location);
}
} else {
if ($this->confirm(sprintf('%s configuration file not found. Would you like to add one?', ucfirst($type)))) {
$this->createConfigYaml($location);
}
}
}
}
Expand Down Expand Up @@ -112,7 +108,6 @@ private function createConfigYaml($location)
'format' => 'Y-m-d H:i:s',
'taskwait' => 5,
'timeout' => 300,
'configsyncdir' => 'sync',
],
];

Expand Down

0 comments on commit 9f5d128

Please sign in to comment.