Improve flutter create help text.
diff --git a/packages/flutter_tools/lib/src/commands/create.dart b/packages/flutter_tools/lib/src/commands/create.dart
index 0610177..5079dec 100644
--- a/packages/flutter_tools/lib/src/commands/create.dart
+++ b/packages/flutter_tools/lib/src/commands/create.dart
@@ -20,17 +20,12 @@
final String name = 'create';
@override
- final String description = 'Create a new Flutter project.';
+ final String description = 'Create a new Flutter project.\nIf run on a project that already exists, this will repair the project, recreating any files that are missing.';
@override
final List<String> aliases = <String>['init'];
CreateCommand() {
- argParser.addOption('out',
- abbr: 'o',
- hide: true,
- help: 'The output directory.'
- );
argParser.addFlag('pub',
defaultsTo: true,
help: 'Whether to run "pub get" after the project has been created.'
@@ -41,6 +36,11 @@
defaultsTo: false,
help: 'Also add a flutter_driver dependency and generate a sample \'flutter drive\' test.'
);
+ argParser.addOption(
+ 'description',
+ defaultsTo: 'A new flutter project.',
+ help: 'The description to use for your new flutter project. This string ends up in the pubspec.yaml file.'
+ );
}
@override
@@ -48,12 +48,18 @@
@override
Future<int> run() async {
- if (!argResults.wasParsed('out') && argResults.rest.isEmpty) {
+ if (argResults.rest.isEmpty) {
printStatus('No option specified for the output directory.');
printStatus(usage);
return 2;
}
+ if (argResults.rest.length > 1) {
+ printStatus('Multiple output directories specified.');
+ printStatus('To create (or repair) a flutter application directory, run "flutter create dirname" where "dirname" is the application directory.');
+ return 2;
+ }
+
if (ArtifactStore.flutterRoot == null) {
printError('Neither the --flutter-root command line flag nor the FLUTTER_ROOT environment');
printError('variable was specified. Unable to find package:flutter.');
@@ -75,14 +81,7 @@
return 2;
}
- Directory projectDir;
-
- if (argResults.wasParsed('out')) {
- projectDir = new Directory(argResults['out']);
- } else {
- projectDir = new Directory(argResults.rest.first);
- }
-
+ Directory projectDir = new Directory(argResults.rest.first);
String dirPath = path.normalize(projectDir.absolute.path);
String projectName = _normalizeProjectName(path.basename(dirPath));
@@ -91,8 +90,13 @@
return 1;
}
- _renderTemplates(projectName, dirPath, flutterPackagesDirectory,
- renderDriverTest: argResults['with-driver-test']);
+ _renderTemplates(
+ projectName,
+ argResults['description'],
+ dirPath,
+ flutterPackagesDirectory,
+ renderDriverTest: argResults['with-driver-test']
+ );
printStatus('');
@@ -132,7 +136,7 @@
return 0;
}
- void _renderTemplates(String projectName, String dirPath,
+ void _renderTemplates(String projectName, String projectDescription, String dirPath,
String flutterPackagesDirectory, { bool renderDriverTest: false }) {
new Directory(dirPath).createSync(recursive: true);
@@ -145,7 +149,7 @@
'projectName': projectName,
'androidIdentifier': _createAndroidIdentifier(projectName),
'iosIdentifier': _createUTIIdentifier(projectName),
- 'description': description,
+ 'description': projectDescription,
'flutterPackagesDirectory': flutterPackagesDirectory,
'androidMinApiLevel': android.minApiLevel
};