diff --git a/packages/flutter_tools/README.md b/packages/flutter_tools/README.md index b91c7dc7c9..51ff9fb1d3 100644 --- a/packages/flutter_tools/README.md +++ b/packages/flutter_tools/README.md @@ -20,11 +20,11 @@ dependencies: ## Running sky_tools Run `sky_tools` (or `pub global run sky_tools`) to see a list of available -commands. +commands: -- *init*: create a new project +- `init` to create a new project -Then run a sky_tools command, like `init`: +Then, run a `sky_tools` command: sky_tools init --out my_sky_project diff --git a/packages/flutter_tools/bin/sky_tools.dart b/packages/flutter_tools/bin/sky_tools.dart index c0771249ed..e5b165af1d 100644 --- a/packages/flutter_tools/bin/sky_tools.dart +++ b/packages/flutter_tools/bin/sky_tools.dart @@ -21,7 +21,14 @@ void main(List args) { parser.addCommand(handler.name, handler.parser); handlers[handler.name] = handler; - ArgResults results = parser.parse(args); + ArgResults results; + + try { + results = parser.parse(args); + } catch (e) { + _printUsage(parser, handlers, e is FormatException ? e.message : '${e}'); + exit(1); + } if (results['help']) { _printUsage(parser, handlers); diff --git a/packages/flutter_tools/lib/src/init.dart b/packages/flutter_tools/lib/src/init.dart index 383961387b..dd8ce41de3 100644 --- a/packages/flutter_tools/lib/src/init.dart +++ b/packages/flutter_tools/lib/src/init.dart @@ -45,9 +45,16 @@ class InitCommandHandler extends CommandHandler { print(''); - String message = 'All done! To run your application:\n' - 'cd ${out.path}\n' - './packages/sky/sky_tool start'; + String message = '''All done! To run your application: + + cd ${out.path} + ./packages/sky/sky_tool start + +Or if the Sky APK is not already on your device, run: + + ./packages/sky/sky_tool start --install + + '''; if (results['pub']) { print("Running pub get..."); @@ -128,8 +135,8 @@ const _readme = r''' ## Getting Started -For help getting started, view our online -[readme](https://github.com/domokit/sky_engine/blob/master/sky/packages/sky/README.md). +For help getting started with Sky, view our online +[documentation](https://github.com/domokit/sky_engine/blob/master/sky/packages/sky/README.md). '''; const _pubspec = r''' @@ -137,23 +144,20 @@ name: {{projectName}} description: {{description}} dependencies: sky: any - sky_tools: any '''; const _libMain = r''' import 'package:sky/widgets.dart'; +void main() => runApp(new HelloWorldApp()); + class HelloWorldApp extends App { Widget build() { return new Scaffold( - toolbar: new ToolBar(center: new Text("Demo")), + toolbar: new ToolBar(center: new Text("Sky Demo")), body: new Material(child: new Center(child: new Text("Hello world!"))), floatingActionButton: new FloatingActionButton( child: new Icon(type: 'content/add', size: 24))); } } - -void main() { - runApp(new HelloWorldApp()); -} '''; diff --git a/packages/flutter_tools/test/init_test.dart b/packages/flutter_tools/test/init_test.dart index 08d8fb22f1..688e41ae83 100644 --- a/packages/flutter_tools/test/init_test.dart +++ b/packages/flutter_tools/test/init_test.dart @@ -32,9 +32,9 @@ defineTests() { results.values['out'] = temp.path; await handler.processArgResults(results); String path = p.join(temp.path, 'lib/main.dart'); - print(path); expect(new File(path).existsSync(), true); - ProcessResult exec = Process.runSync('dartanalyzer', [path], + ProcessResult exec = Process.runSync( + 'dartanalyzer', ['--fatal-warnings', path], workingDirectory: temp.path); expect(exec.exitCode, 0); });