Skip to content

Commit c8a6e4f

Browse files
committed
Add quit shortcut
1 parent 7b6abbf commit c8a6e4f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

docs/running_psalm/command_line_usage.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Psalm now offers a `psalm-review` tool which allows you to manually review issue
5454
./vendor/bin/psalm-review report.json code|phpstorm|code-server [ inv|rev|[~-]IssueType1 ] [ [~-]IssueType2 ] ...
5555
```
5656

57-
`psalm-review` parse the Psalm JSON report in report.json (generated using `vendor/bin/psalm --report=report.json`) and open the specified IDE at the line and column of the issue, one by one for all issues; press enter to go to the next issue.
57+
`psalm-review` parse the Psalm JSON report in report.json (generated using `vendor/bin/psalm --report=report.json`) and open the specified IDE at the line and column of the issue, one by one for all issues; press enter to go to the next issue, `q` to quit.
5858

5959
The extra arguments may be used to filter only for issues of the specified types, or for all issues except the specified types (with the `~` or `-` inversion).
6060

src/Psalm/Internal/Cli/Review.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
use function strlen;
3434
use function strpos;
3535
use function substr;
36+
use function trim;
3637

3738
use const JSON_THROW_ON_ERROR;
3839
use const PHP_EOL;
@@ -151,7 +152,11 @@ public static function run(array $argv): void
151152
echo PHP_EOL;
152153

153154
self::r($mode($file, $line, $column));
154-
readline();
155+
156+
/** @psalm-suppress RiskyTruthyFalsyComparison */
157+
if (trim(readline("Press enter to continue, q to exit.") ?: '') === 'q') {
158+
break;
159+
}
155160
}
156161
}
157162

@@ -164,7 +169,7 @@ private static function help(): never
164169
"Will parse the Psalm JSON report in report.json ".
165170
"and open the specified IDE at the line and column of the issue, ".
166171
"one by one for all issues.".PHP_EOL.
167-
"Press enter to go to the next issue.".PHP_EOL.PHP_EOL.
172+
"Press enter to go to the next issue, q to quit.".PHP_EOL.PHP_EOL.
168173
"The extra arguments may be used to filter only for issues of the specified types, ".
169174
"or for all issues except the specified types (with the ~ or - inversion);".PHP_EOL.
170175
"rev|inv keywords may be used to start from the end of the report.".PHP_EOL.PHP_EOL,

0 commit comments

Comments
 (0)