1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-06 16:50:09 +01:00

Add --print flag to print output while diagnostics are running

This commit is contained in:
Aryeh Raber
2020-04-25 14:33:24 +02:00
parent ead9568aca
commit e59fa533f1
2 changed files with 13 additions and 5 deletions

View File

@@ -54,11 +54,17 @@ function __construct(CommandLine $cli, Filesystem $files)
/**
* Run diagnostics.
*/
function run()
function run($print)
{
$result = collect($this->commands)->map(function ($command) {
$result = collect($this->commands)->map(function ($command) use ($print) {
$output = $this->cli->runAsUser($command);
if ($print) {
output(str_repeat('-', 25));
info("$ $command");
output(trim($output));
}
return implode(PHP_EOL, ["$ $command", trim($output)]);
})->implode(PHP_EOL.str_repeat('-', 25).PHP_EOL);

View File

@@ -537,13 +537,15 @@
/**
* Output diagnostics to aid in debugging Valet.
*/
$app->command('diagnose', function () {
$app->command('diagnose [-p|--print]', function ($print) {
info('Running diagnostics...');
Diagnose::run();
Diagnose::run($print);
info('Diagnostics output has been copied to your clipboard.');
})->descriptions('Output diagnostics to aid in debugging Valet.');
})->descriptions('Output diagnostics to aid in debugging Valet.', [
'--print' => 'print diagnostics output while running'
]);
}
/**