Help verbose show hidden options (#5979) * show hidden flags when showing verbose help * flutter -v show verbose help
diff --git a/packages/flutter_tools/lib/executable.dart b/packages/flutter_tools/lib/executable.dart index e9148ac..988a205 100644 --- a/packages/flutter_tools/lib/executable.dart +++ b/packages/flutter_tools/lib/executable.dart
@@ -47,8 +47,9 @@ /// /// This function is intended to be used from the `flutter` command line tool. Future<Null> main(List<String> args) async { - bool help = args.contains('-h') || args.contains('--help'); bool verbose = args.contains('-v') || args.contains('--verbose'); + bool help = args.contains('-h') || args.contains('--help') || + (args.isNotEmpty && args.first == 'help') || (args.length == 1 && verbose); bool verboseHelp = help && verbose; if (verboseHelp) { @@ -58,8 +59,8 @@ } FlutterCommandRunner runner = new FlutterCommandRunner(verboseHelp: verboseHelp) - ..addCommand(new AnalyzeCommand()) - ..addCommand(new BuildCommand()) + ..addCommand(new AnalyzeCommand(verboseHelp: verboseHelp)) + ..addCommand(new BuildCommand(verboseHelp: verboseHelp)) ..addCommand(new ChannelCommand()) ..addCommand(new ConfigCommand()) ..addCommand(new CreateCommand()) @@ -74,7 +75,7 @@ ..addCommand(new PackagesCommand()) ..addCommand(new PrecacheCommand()) ..addCommand(new RefreshCommand()) - ..addCommand(new RunCommand()) + ..addCommand(new RunCommand(verboseHelp: verboseHelp)) ..addCommand(new RunMojoCommand(hidden: !verboseHelp)) ..addCommand(new ScreenshotCommand()) ..addCommand(new SetupCommand(hidden: !verboseHelp))
diff --git a/packages/flutter_tools/lib/src/commands/analyze.dart b/packages/flutter_tools/lib/src/commands/analyze.dart index ff2dd8f..3f27e93 100644 --- a/packages/flutter_tools/lib/src/commands/analyze.dart +++ b/packages/flutter_tools/lib/src/commands/analyze.dart
@@ -23,7 +23,7 @@ typedef bool FileFilter(FileSystemEntity entity); class AnalyzeCommand extends FlutterCommand { - AnalyzeCommand() { + AnalyzeCommand({bool verboseHelp: false}) { argParser.addFlag('flutter-repo', help: 'Include all the examples and tests from the Flutter repository.', defaultsTo: false); argParser.addFlag('current-directory', help: 'Include all the Dart files in the current directory, if any.', defaultsTo: true); argParser.addFlag('current-package', help: 'Include the lib/main.dart file from the current directory, if any.', defaultsTo: true); @@ -32,10 +32,10 @@ argParser.addFlag('congratulate', help: 'Show output even when there are no errors, warnings, hints, or lints.', defaultsTo: true); argParser.addFlag('watch', help: 'Run analysis continuously, watching the filesystem for changes.', negatable: false); argParser.addOption('write', valueHelp: 'file', help: 'Also output the results to a file. This is useful with --watch if you want a file to always contain the latest results.'); - argParser.addOption('dart-sdk', valueHelp: 'path-to-sdk', help: 'The path to the Dart SDK.', hide: true); + argParser.addOption('dart-sdk', valueHelp: 'path-to-sdk', help: 'The path to the Dart SDK.', hide: !verboseHelp); // Hidden option to enable a benchmarking mode. - argParser.addFlag('benchmark', negatable: false, hide: true); + argParser.addFlag('benchmark', negatable: false, hide: !verboseHelp); usesPubOption(); }
diff --git a/packages/flutter_tools/lib/src/commands/build.dart b/packages/flutter_tools/lib/src/commands/build.dart index 7351349..ace05fd 100644 --- a/packages/flutter_tools/lib/src/commands/build.dart +++ b/packages/flutter_tools/lib/src/commands/build.dart
@@ -17,12 +17,12 @@ import 'build_ios.dart'; class BuildCommand extends FlutterCommand { - BuildCommand() { + BuildCommand({bool verboseHelp: false}) { addSubcommand(new BuildApkCommand()); addSubcommand(new BuildAotCommand()); addSubcommand(new BuildCleanCommand()); addSubcommand(new BuildIOSCommand()); - addSubcommand(new BuildFlxCommand()); + addSubcommand(new BuildFlxCommand(verboseHelp: verboseHelp)); } @override
diff --git a/packages/flutter_tools/lib/src/commands/build_flx.dart b/packages/flutter_tools/lib/src/commands/build_flx.dart index 4000ee6..73b56be 100644 --- a/packages/flutter_tools/lib/src/commands/build_flx.dart +++ b/packages/flutter_tools/lib/src/commands/build_flx.dart
@@ -10,12 +10,12 @@ import 'build.dart'; class BuildFlxCommand extends BuildSubCommand { - BuildFlxCommand() { + BuildFlxCommand({bool verboseHelp: false}) { usesTargetOption(); argParser.addFlag('precompiled', negatable: false); // This option is still referenced by the iOS build scripts. We should // remove it once we've updated those build scripts. - argParser.addOption('asset-base', help: 'Ignored. Will be removed.', hide: true); + argParser.addOption('asset-base', help: 'Ignored. Will be removed.', hide: !verboseHelp); argParser.addOption('manifest', defaultsTo: defaultManifestPath); argParser.addOption('private-key', defaultsTo: defaultPrivateKeyPath); argParser.addOption('output-file', abbr: 'o', defaultsTo: defaultFlxOutputPath);
diff --git a/packages/flutter_tools/lib/src/commands/run.dart b/packages/flutter_tools/lib/src/commands/run.dart index 0a878ac..c44a61b 100644 --- a/packages/flutter_tools/lib/src/commands/run.dart +++ b/packages/flutter_tools/lib/src/commands/run.dart
@@ -45,7 +45,7 @@ @override final String description = 'Run your Flutter app on an attached device.'; - RunCommand() { + RunCommand({bool verboseHelp: false}) { argParser.addFlag('full-restart', defaultsTo: true, help: 'Stop any currently running application process before running the app.'); @@ -59,7 +59,7 @@ defaultsTo: true, help: 'If necessary, build the app before running.'); argParser.addOption('use-application-binary', - hide: true, + hide: !verboseHelp, help: 'Specify a pre-built application binary to use when running.'); usesPubOption(); @@ -80,7 +80,7 @@ // application, measure the startup time and the app restart time, write the // results out to 'refresh_benchmark.json', and exit. This flag is intended // for use in generating automated flutter benchmarks. - argParser.addFlag('benchmark', negatable: false, hide: true); + argParser.addFlag('benchmark', negatable: false, hide: !verboseHelp); } Device device;
diff --git a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart index 5708043..5009c19 100644 --- a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart +++ b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
@@ -86,7 +86,7 @@ @override String get usageFooter { - return 'Run "flutter -h -v" for verbose help output, including less commonly used options.'; + return 'Run "flutter help -v" for verbose help output, including less commonly used options.'; } static String get _defaultFlutterRoot {