Skip to content

Commit

Permalink
TaskProcess: better handling with booleans
Browse files Browse the repository at this point in the history
  • Loading branch information
martenb authored and Milan Felix Šulc committed May 1, 2019
1 parent d2c8abc commit 7e614b4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/TaskProcess.php
Expand Up @@ -81,14 +81,17 @@ protected function getParam($param, $default = null)
$displayDefault = $default;

if (is_bool($default)) {
$displayDefault = $default ? 'true' : 'false';
$displayDefault = $default ? 'yes' : 'no';
} elseif ($default === null) {
$displayDefault = 'null';
}

if (!$this->io->isInteractive()) return $default;

return $this->io->ask(
return is_bool($default) ? $this->io->askConfirmation(
sprintf('<question>%s</question> (<comment>%s</comment>): ', $param, $displayDefault),
$default
) : $this->io->ask(
sprintf('<question>%s</question> (<comment>%s</comment>): ', $param, $displayDefault),
$default
);
Expand Down

0 comments on commit 7e614b4

Please sign in to comment.