Skip to content

Commit f418447

Browse files
authored
Merge pull request #4646 from Laravel-Backpack/askhint-helper
Added `askHint` helper on PrettyCommandOutput
2 parents 8b183dd + b57427e commit f418447

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/app/Console/Commands/Traits/PrettyCommandOutput.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,20 @@ public function deleteLines(int $amount = 1)
231231
$this->output->write(str_repeat("\033[A\33[2K\r", $amount));
232232
}
233233

234+
/**
235+
* @return void
236+
*/
237+
public function askHint(string $question, array $hints, string $default)
238+
{
239+
$hints = collect($hints)
240+
->map(function ($hint) {
241+
return " <fg=gray>│ $hint</>";
242+
})
243+
->join(PHP_EOL);
244+
245+
return $this->ask($question.PHP_EOL.$hints, $default);
246+
}
247+
234248
/**
235249
* Deletes one or multiple chars.
236250
*

0 commit comments

Comments
 (0)