Skip to content
This repository has been archived by the owner on Apr 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #16 from Muetze42/development
Browse files Browse the repository at this point in the history
feat: add ask skipable to command
  • Loading branch information
Muetze42 authored Oct 20, 2023
2 parents 97e247f + 2da6397 commit bcc1d9a
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/LuraCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class LuraCommand extends Command
{
/**
* The Installer Configurations
* The Installer Configurations.
*
* @var array
*/
Expand Down Expand Up @@ -358,4 +358,23 @@ public function replaceNth(string $pattern, string $replace, string $subject, in
return $m[0];
}, $subject);
}

/**
* Prompt the user for skippable input.
*
* @param string $question
* @param string|null $default
*
* @return mixed
*/
public function askSkippable(string $question, string $default = null): mixed
{
$question = $this->ask(trim($question) . ' [n to skip]', $default = null);

if (strtolower($question) == 'n') {
$question = null;
}

return $question;
}
}

0 comments on commit bcc1d9a

Please sign in to comment.