Help verbose show hidden options (#5979)
* show hidden flags when showing verbose help * flutter -v show verbose help
This commit is contained in:
@@ -47,8 +47,9 @@ import 'src/runner/flutter_command_runner.dart';
|
||||
///
|
||||
/// 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 @@ Future<Null> main(List<String> args) async {
|
||||
}
|
||||
|
||||
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 @@ Future<Null> main(List<String> args) async {
|
||||
..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))
|
||||
|
||||
@@ -23,7 +23,7 @@ bool isDartFile(FileSystemEntity entry) => entry is File && entry.path.endsWith(
|
||||
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 @@ class AnalyzeCommand extends FlutterCommand {
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -17,12 +17,12 @@ import 'build_flx.dart';
|
||||
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
|
||||
|
||||
@@ -10,12 +10,12 @@ import '../globals.dart';
|
||||
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);
|
||||
|
||||
@@ -45,7 +45,7 @@ class RunCommand extends RunCommandBase {
|
||||
@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 @@ class RunCommand extends RunCommandBase {
|
||||
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 @@ class RunCommand extends RunCommandBase {
|
||||
// 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;
|
||||
|
||||
@@ -86,7 +86,7 @@ class FlutterCommandRunner extends CommandRunner {
|
||||
|
||||
@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 {
|
||||
|
||||
Reference in New Issue
Block a user