Skip to content

Commit e5aba73

Browse files
matanlureykorca0220
authored andcommitted
Add support for /? to alias to --help (flutter#172328)
Closes flutter#70616.
1 parent 7462c96 commit e5aba73

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

packages/flutter_tools/lib/executable.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,15 @@ Future<void> main(List<String> args) async {
6565
final bool veryVerbose = args.contains('-vv');
6666
final bool verbose = args.contains('-v') || args.contains('--verbose') || veryVerbose;
6767
final bool prefixedErrors = args.contains('--prefixed-errors');
68-
// Support the -? Powershell help idiom.
68+
// Support universal help idioms.
6969
final int powershellHelpIndex = args.indexOf('-?');
7070
if (powershellHelpIndex != -1) {
7171
args[powershellHelpIndex] = '-h';
7272
}
73+
final int slashQuestionHelpIndex = args.indexOf('/?');
74+
if (slashQuestionHelpIndex != -1) {
75+
args[slashQuestionHelpIndex] = '-h';
76+
}
7377

7478
final bool doctor =
7579
(args.isNotEmpty && args.first == 'doctor') ||

packages/flutter_tools/test/integration.shard/command_output_test.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,19 @@ void main() {
4242
);
4343
});
4444

45+
testWithoutContext('Flutter help is shown with /? command line argument', () async {
46+
final ProcessResult result = await processManager.run(<String>[flutterBin, '/?']);
47+
48+
// Development tools.
49+
expect(
50+
result.stdout,
51+
contains(
52+
'Run "flutter help <command>" for more information about a command.\n'
53+
'Run "flutter help -v" for verbose help output, including less commonly used options.',
54+
),
55+
);
56+
});
57+
4558
testWithoutContext('flutter doctor is not verbose', () async {
4659
final ProcessResult result = await processManager.run(<String>[flutterBin, 'doctor', '-v']);
4760

0 commit comments

Comments
 (0)