Skip to content

Commit 973404a

Browse files
author
Jonah Williams
authored
[flutter_tools] support powershell style help request (flutter#67493)
1 parent e3c441e commit 973404a

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

packages/flutter_tools/lib/executable.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ import 'src/web/web_runner.dart';
6060
Future<void> main(List<String> args) async {
6161
final bool veryVerbose = args.contains('-vv');
6262
final bool verbose = args.contains('-v') || args.contains('--verbose') || veryVerbose;
63+
// Support the -? Powershell help idiom.
64+
final int powershellHelpIndex = args.indexOf('-?');
65+
if (powershellHelpIndex != -1) {
66+
args[powershellHelpIndex] = '-h';
67+
}
6368

6469
final bool doctor = (args.isNotEmpty && args.first == 'doctor') ||
6570
(args.length == 2 && verbose && args.last == 'doctor');

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@ void main() {
3333
expect(result.stdout, isNot(contains('exiting with code 0')));
3434
});
3535

36+
testWithoutContext('Flutter help is shown with -? command line argument', () async {
37+
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
38+
final ProcessResult result = await processManager.run(<String>[
39+
flutterBin,
40+
...getLocalEngineArguments(),
41+
'-?',
42+
]);
43+
44+
// Development tools.
45+
expect(result.stdout, contains(
46+
'Run "flutter help <command>" for more information about a command.\n'
47+
'Run "flutter help -v" for verbose help output, including less commonly used options.'
48+
));
49+
});
50+
3651
testWithoutContext('flutter doctor is not verbose', () async {
3752
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
3853
final ProcessResult result = await processManager.run(<String>[

0 commit comments

Comments
 (0)