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
This commit is contained in:
Greg Spencer
2019-02-21 15:56:59 -08:00
committed by GitHub
parent 04b7a5b366
commit b316940051
2 changed files with 8 additions and 3 deletions

View File

@@ -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',

View File

@@ -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<void> {
@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;