Skip to content

Commit

Permalink
fix:choice_question
Browse files Browse the repository at this point in the history
  • Loading branch information
wenjy committed Jan 31, 2024
1 parent 81990c4 commit c20aa94
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/Commands/ModelGen.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ protected function generateCode()
echo "The following files will be generated:\n";
$skipAll = null;
$answers = [];
$choice_question = <<<EOF
Do you want to overwrite this file?
y:Overwrite this file.
n:Skip this file.
ya:Overwrite this and the rest of the changed files.
na:Skip this and the rest of the changed files.
v:View difference.
EOF;

foreach ($files as $file) {
$path = $file->getRelativePath();
if (is_file($file->path)) {
Expand All @@ -71,13 +80,7 @@ protected function generateCode()
$answers[$file->id] = !$skipAll;
} else {
do {
$answer = $this->choice("Do you want to overwrite this file?
y:Overwrite this file.
n:Skip this file.
ya:Overwrite this and the rest of the changed files.
na:Skip this and the rest of the changed files.
v:View difference
", [
$answer = $this->choice($choice_question, [
'y' ,
'n' ,
'ya' ,
Expand Down

0 comments on commit c20aa94

Please sign in to comment.