From b3169400510a008eee0d895d1a3e56e2ce096f9d Mon Sep 17 00:00:00 2001 From: Greg Spencer Date: Thu, 21 Feb 2019 15:56:59 -0800 Subject: [PATCH] Fix the length of the valueHelp on the --sample option for the create command, and turn on wrapping. (#28264) The wrapping for some commands was never actually turned on, so this turns it on. Also, it shortens the `valueHelp` for the `--sample` option to be just "id" instead of "the sample ID of the desired sample from the API documentation website (http://docs.flutter.io)", which was causing the line to get far too long. Fixes #23074 --- packages/flutter_tools/lib/src/commands/create.dart | 5 +++-- packages/flutter_tools/lib/src/runner/flutter_command.dart | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/flutter_tools/lib/src/commands/create.dart b/packages/flutter_tools/lib/src/commands/create.dart index 53fdd7bc7c..a9eb52743e 100644 --- a/packages/flutter_tools/lib/src/commands/create.dart +++ b/packages/flutter_tools/lib/src/commands/create.dart @@ -90,9 +90,10 @@ class CreateCommand extends FlutterCommand { 'sample', abbr: 's', help: 'Specifies the Flutter code sample to use as the main.dart for an application. Implies ' - '--template=app.', + '--template=app. The value should be the sample ID of the desired sample from the API ' + 'documentation website (http://docs.flutter.io).', defaultsTo: null, - valueHelp: 'the sample ID of the desired sample from the API documentation website (http://docs.flutter.io)' + valueHelp: 'id', ); argParser.addFlag( 'overwrite', diff --git a/packages/flutter_tools/lib/src/runner/flutter_command.dart b/packages/flutter_tools/lib/src/runner/flutter_command.dart index fc93ba6abe..a92cb7e134 100644 --- a/packages/flutter_tools/lib/src/runner/flutter_command.dart +++ b/packages/flutter_tools/lib/src/runner/flutter_command.dart @@ -13,6 +13,7 @@ import '../application_package.dart'; import '../base/common.dart'; import '../base/context.dart'; import '../base/file_system.dart'; +import '../base/terminal.dart'; import '../base/time.dart'; import '../base/user_messages.dart'; import '../base/utils.dart'; @@ -82,7 +83,10 @@ abstract class FlutterCommand extends Command { @override ArgParser get argParser => _argParser; - final ArgParser _argParser = ArgParser(allowTrailingOptions: false); + final ArgParser _argParser = ArgParser( + allowTrailingOptions: false, + usageLineLength: outputPreferences.wrapText ? outputPreferences.wrapColumn : null, + ); @override FlutterCommandRunner get runner => super.runner;