Skip to content

Commit d16d3bf

Browse files
committed
feat: add new Diagnose commands to output the version number of gsudo, ansicon, and acrylic.
Added: - Added `Diagnose` commands to get the version output of `gsudo`, `ansicon`, and `acrylic`. Gsudo and ansicon use the `packageExe` method of their respective package class. Acrylic doesn't have a cli command to get the version, so we have to get the contents of it's Readme.txt, and find the version later on. - Added a conditional to the `editOutput` to edit the output of Acrylic's Readme.txt. We use regex to find the version number within the file contents, and only output that instead of the whole file. - Added gsudo, ansicon, and acrylic to the `combineWithHeadings` method. Changed: - Changed the command that gets the contents of valet's `config.json` to use the `Configuration::path` method instead of repeating it's path.
1 parent da7263f commit d16d3bf

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

cli/Valet/Diagnose.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,16 @@ public function __construct(CommandLine $cli, Filesystem $files) {
3232
$this->commands = [
3333
'systeminfo',
3434
'valet --version',
35-
'cat ~/.config/valet/config.json',
35+
'cat ' . \Configuration::path(),
3636
$nginxPkgClass->packageExe() . ' -v 2>&1',
3737
$nginxPkgClass->packageExe() . ' -c \"' . $nginxPkgClass->packagePath() . '/conf/nginx.conf\" -t -p ' . $nginxPkgClass->packagePath() . ' 2>&1',
3838

3939
'foreach ($file in get-ChildItem -Path "' . $nginxPkgClass->packagePath() . '/conf/nginx.conf", "' . $nginxPkgClass->packagePath() . '/valet/valet.conf", "' . VALET_HOME_PATH . '/Nginx/*.conf"){echo $file.fullname --------------------`n; Get-Content -Path $file; echo `n;}',
4040

4141
valetBinPath() . 'ngrok.exe version',
42+
resolve(Packages\Gsudo::class)->packageExe() . ' -v',
43+
resolve(Packages\Ansicon::class)->packageExe() . ' /?',
44+
'cat "' . valetBinPath() . 'acrylic/Readme.txt"',
4245
'php -v',
4346
'cmd /C "where /f php"',
4447
'php --ini',
@@ -224,6 +227,12 @@ protected function editOutput($command, $output) {
224227
$output = json_encode($output, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);
225228
}
226229

230+
if (str_contains($command, "acrylic")) {
231+
if (preg_match("/version is:\s+\d+(\.\d+)+/", $output, $matches)) {
232+
$output = "Acrylic " . preg_replace("/:\s+/", " ", $matches[0]);
233+
}
234+
}
235+
227236
return $output;
228237
}
229238

@@ -408,6 +417,9 @@ protected function combineWithHeadings($results) {
408417
"nginx Config Check",
409418
"nginx Config Files",
410419
"ngrok Version",
420+
"gsudo Version",
421+
"Ansicon Version",
422+
"Acrylic Version",
411423
"PHP Version",
412424
"PHP Location",
413425
"PHP Ini Location",
@@ -419,4 +431,4 @@ protected function combineWithHeadings($results) {
419431
"Outdated Composer Packages"
420432
])->combine($results);
421433
}
422-
}
434+
}

0 commit comments

Comments
 (0)