Commit 09cca3b3 authored by Devon Carew's avatar Devon Carew

massage the help text

parent 4dc19e3f
...@@ -32,7 +32,10 @@ import 'src/runner/flutter_command_runner.dart'; ...@@ -32,7 +32,10 @@ import 'src/runner/flutter_command_runner.dart';
/// ///
/// This function is intended to be used from the [flutter] command line tool. /// This function is intended to be used from the [flutter] command line tool.
Future main(List<String> args) async { Future main(List<String> args) async {
FlutterCommandRunner runner = new FlutterCommandRunner() bool help = args.contains('-h') || args.contains('--help');
bool verbose = args.contains('-v') || args.contains('--verbose');
FlutterCommandRunner runner = new FlutterCommandRunner(verboseHelp: help && verbose)
..addCommand(new AnalyzeCommand()) ..addCommand(new AnalyzeCommand())
..addCommand(new ApkCommand()) ..addCommand(new ApkCommand())
..addCommand(new BuildCommand()) ..addCommand(new BuildCommand())
......
...@@ -12,10 +12,11 @@ import 'start.dart'; ...@@ -12,10 +12,11 @@ import 'start.dart';
class ListenCommand extends StartCommandBase { class ListenCommand extends StartCommandBase {
final String name = 'listen'; final String name = 'listen';
final String description = final String description =
'Listen for changes to files and reload the running app on all\n' 'Listen for changes to files and reload the running app on all connected devices '
'connected devices (Android only). By default, only listens to\n' '(Android only).';
'"./" and "./lib/". To listen to additional directories, list them on\n' final String usageFooter =
'the command line.'; 'By default, only listens to "./" and "./lib/". To listen to additional directories, list them on\n'
'the command line.';
/// Only run once. Used for testing. /// Only run once. Used for testing.
final bool singleRun; final bool singleRun;
......
...@@ -11,11 +11,11 @@ import '../runner/flutter_command.dart'; ...@@ -11,11 +11,11 @@ import '../runner/flutter_command.dart';
class TraceCommand extends FlutterCommand { class TraceCommand extends FlutterCommand {
final String name = 'trace'; final String name = 'trace';
final String description = 'Start and stop tracing for a running Flutter app ' final String description = 'Start and stop tracing for a running Flutter app (Android only).';
'(Android only).\n' final String usageFooter =
'To start a trace, wait, then stop the trace, don\'t set any flags ' '\`trace\` called with no arguments will automatically start tracing, delay a set amount of\n'
'except (optionally) duration.\n' 'time (controlled by --duration), and stop tracing. To explicitly control tracing, call trace\n'
'Otherwise, specify either start or stop to manually control the trace.'; 'with --start and later with --stop.';
TraceCommand() { TraceCommand() {
argParser.addFlag('start', negatable: false, help: 'Start tracing.'); argParser.addFlag('start', negatable: false, help: 'Start tracing.');
......
...@@ -22,15 +22,21 @@ const String kFlutterToolsScriptFileName = 'flutter_tools.dart'; // in //flutter ...@@ -22,15 +22,21 @@ const String kFlutterToolsScriptFileName = 'flutter_tools.dart'; // in //flutter
const String kFlutterEnginePackageName = 'sky_engine'; const String kFlutterEnginePackageName = 'sky_engine';
class FlutterCommandRunner extends CommandRunner { class FlutterCommandRunner extends CommandRunner {
FlutterCommandRunner() FlutterCommandRunner({ bool verboseHelp: false }) : super(
: super('flutter', 'Manage your Flutter app development.') { 'flutter',
'Manage your Flutter app development.'
) {
argParser.addFlag('verbose', argParser.addFlag('verbose',
abbr: 'v', abbr: 'v',
negatable: false, negatable: false,
help: 'Noisy logging, including all shell commands executed.'); help: 'Noisy logging, including all shell commands executed.');
argParser.addOption('device-id',
abbr: 'd',
help: 'Target device id.');
argParser.addFlag('version', argParser.addFlag('version',
negatable: false, negatable: false,
help: 'Reports the version of this tool.'); help: 'Reports the version of this tool.');
String packagesHelp; String packagesHelp;
if (ArtifactStore.isPackageRootValid) if (ArtifactStore.isPackageRootValid)
packagesHelp = '\n(defaults to "${ArtifactStore.packageRoot}")'; packagesHelp = '\n(defaults to "${ArtifactStore.packageRoot}")';
...@@ -42,63 +48,72 @@ class FlutterCommandRunner extends CommandRunner { ...@@ -42,63 +48,72 @@ class FlutterCommandRunner extends CommandRunner {
help: 'The root directory of the Flutter repository. Defaults to \$$kFlutterRootEnvironmentVariableName if set,\n' help: 'The root directory of the Flutter repository. Defaults to \$$kFlutterRootEnvironmentVariableName if set,\n'
'otherwise defaults to a value derived from the location of this tool.', defaultsTo: _defaultFlutterRoot); 'otherwise defaults to a value derived from the location of this tool.', defaultsTo: _defaultFlutterRoot);
argParser.addOption('device-id', if (verboseHelp)
abbr: 'd', argParser.addSeparator('Local build selection options (not normally required):');
help: 'Target device id.');
argParser.addSeparator('Local build selection options (not normally required):');
argParser.addFlag('debug', argParser.addFlag('debug',
negatable: false, negatable: false,
hide: !verboseHelp,
help: help:
'Set this if you are building Flutter locally and want to use the debug build products.\n' 'Set this if you are building Flutter locally and want to use the debug build products.\n'
'Defaults to true if --engine-src-path is specified and --release is not, otherwise false.'); 'Defaults to true if --engine-src-path is specified and --release is not, otherwise false.');
argParser.addFlag('release', argParser.addFlag('release',
negatable: false, negatable: false,
hide: !verboseHelp,
help: help:
'Set this if you are building Flutter locally and want to use the release build products.\n' 'Set this if you are building Flutter locally and want to use the release build products.\n'
'The --release option is not compatible with the listen command on iOS devices and simulators.'); 'The --release option is not compatible with the listen command on iOS devices and simulators.');
argParser.addOption('engine-src-path', argParser.addOption('engine-src-path',
hide: !verboseHelp,
help: help:
'Path to your engine src directory, if you are building Flutter locally.\n' 'Path to your engine src directory, if you are building Flutter locally.\n'
'Defaults to \$$kFlutterEngineEnvironmentVariableName if set, otherwise defaults to the path given in your pubspec.yaml\n' 'Defaults to \$$kFlutterEngineEnvironmentVariableName if set, otherwise defaults to the path given in your pubspec.yaml\n'
'dependency_overrides for $kFlutterEnginePackageName, if any, or, failing that, tries to guess at the location\n' 'dependency_overrides for $kFlutterEnginePackageName, if any, or, failing that, tries to guess at the location\n'
'based on the value of the --flutter-root option.'); 'based on the value of the --flutter-root option.');
argParser.addOption('host-debug-build-path', hide: true, argParser.addOption('host-debug-build-path',
hide: !verboseHelp,
help: help:
'Path to your host Debug out directory (i.e. the one that runs on your workstation, not a device), if you are building Flutter locally.\n' 'Path to your host Debug out directory (i.e. the one that runs on your workstation, not a device), if you are building Flutter locally.\n'
'This path is relative to --engine-src-path. Not normally required.', 'This path is relative to --engine-src-path. Not normally required.',
defaultsTo: 'out/Debug/'); defaultsTo: 'out/Debug/');
argParser.addOption('host-release-build-path', hide: true, argParser.addOption('host-release-build-path',
hide: !verboseHelp,
help: help:
'Path to your host Release out directory (i.e. the one that runs on your workstation, not a device), if you are building Flutter locally.\n' 'Path to your host Release out directory (i.e. the one that runs on your workstation, not a device), if you are building Flutter locally.\n'
'This path is relative to --engine-src-path. Not normally required.', 'This path is relative to --engine-src-path. Not normally required.',
defaultsTo: 'out/Release/'); defaultsTo: 'out/Release/');
argParser.addOption('android-debug-build-path', hide: true, argParser.addOption('android-debug-build-path',
hide: !verboseHelp,
help: help:
'Path to your Android Debug out directory, if you are building Flutter locally.\n' 'Path to your Android Debug out directory, if you are building Flutter locally.\n'
'This path is relative to --engine-src-path. Not normally required.', 'This path is relative to --engine-src-path. Not normally required.',
defaultsTo: 'out/android_Debug/'); defaultsTo: 'out/android_Debug/');
argParser.addOption('android-release-build-path', hide: true, argParser.addOption('android-release-build-path',
hide: !verboseHelp,
help: help:
'Path to your Android Release out directory, if you are building Flutter locally.\n' 'Path to your Android Release out directory, if you are building Flutter locally.\n'
'This path is relative to --engine-src-path. Not normally required.', 'This path is relative to --engine-src-path. Not normally required.',
defaultsTo: 'out/android_Release/'); defaultsTo: 'out/android_Release/');
argParser.addOption('ios-debug-build-path', hide: true, argParser.addOption('ios-debug-build-path',
hide: !verboseHelp,
help: help:
'Path to your iOS Debug out directory, if you are building Flutter locally.\n' 'Path to your iOS Debug out directory, if you are building Flutter locally.\n'
'This path is relative to --engine-src-path. Not normally required.', 'This path is relative to --engine-src-path. Not normally required.',
defaultsTo: 'out/ios_Debug/'); defaultsTo: 'out/ios_Debug/');
argParser.addOption('ios-release-build-path', hide: true, argParser.addOption('ios-release-build-path',
hide: !verboseHelp,
help: help:
'Path to your iOS Release out directory, if you are building Flutter locally.\n' 'Path to your iOS Release out directory, if you are building Flutter locally.\n'
'This path is relative to --engine-src-path. Not normally required.', 'This path is relative to --engine-src-path. Not normally required.',
defaultsTo: 'out/ios_Release/'); defaultsTo: 'out/ios_Release/');
argParser.addOption('ios-sim-debug-build-path', hide: true, argParser.addOption('ios-sim-debug-build-path',
hide: !verboseHelp,
help: help:
'Path to your iOS Simulator Debug out directory, if you are building Flutter locally.\n' 'Path to your iOS Simulator Debug out directory, if you are building Flutter locally.\n'
'This path is relative to --engine-src-path. Not normally required.', 'This path is relative to --engine-src-path. Not normally required.',
defaultsTo: 'out/ios_sim_Debug/'); defaultsTo: 'out/ios_sim_Debug/');
argParser.addOption('ios-sim-release-build-path', hide: true, argParser.addOption('ios-sim-release-build-path',
hide: !verboseHelp,
help: help:
'Path to your iOS Simulator Release out directory, if you are building Flutter locally.\n' 'Path to your iOS Simulator Release out directory, if you are building Flutter locally.\n'
'This path is relative to --engine-src-path. Not normally required.', 'This path is relative to --engine-src-path. Not normally required.',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment