platform-cli/bin/angel.dart

56 lines
1.4 KiB
Dart
Raw Normal View History

2016-07-05 21:20:01 +00:00
#!/usr/bin/env dart
2017-06-15 01:13:03 +00:00
library angel_cli.tool;
2016-07-05 21:19:02 +00:00
2016-09-14 04:33:28 +00:00
import "dart:io";
import "package:args/command_runner.dart";
2016-07-05 21:19:02 +00:00
import 'package:angel_cli/angel_cli.dart';
2019-04-29 17:41:35 +00:00
import 'package:io/ansi.dart';
2016-07-05 21:19:02 +00:00
2016-09-14 04:33:28 +00:00
final String DOCTOR = "doctor";
2017-03-24 20:25:50 +00:00
main(List<String> args) async {
2018-07-14 23:13:32 +00:00
var runner = new CommandRunner(
"angel",
asciiArt.trim() +
'\n\n' +
"Command-line tools for the Angel framework." +
'\n\n' +
'https://angel-dart.github.io');
2016-09-14 04:33:28 +00:00
2018-07-14 23:06:48 +00:00
runner.argParser
2018-07-14 23:13:32 +00:00
.addFlag('verbose', help: 'Print verbose output.', negatable: false);
2018-07-14 23:06:48 +00:00
2016-12-10 18:52:14 +00:00
runner
2018-07-15 04:11:38 +00:00
..addCommand(new DeployCommand())
2016-12-10 18:52:14 +00:00
..addCommand(new DoctorCommand())
2016-12-24 04:42:55 +00:00
..addCommand(new KeyCommand())
2016-12-10 18:52:14 +00:00
..addCommand(new InitCommand())
2017-10-20 01:06:15 +00:00
..addCommand(new InstallCommand())
2017-06-15 01:13:03 +00:00
..addCommand(new RenameCommand())
2018-07-14 22:36:10 +00:00
..addCommand(new MakeCommand());
2017-03-24 20:25:50 +00:00
2019-04-29 17:41:35 +00:00
return await runner.run(args).catchError((exc, st) {
2018-07-14 22:54:38 +00:00
if (exc is String) {
stdout.writeln(exc);
} else {
stderr.writeln("Oops, something went wrong: $exc");
2018-07-14 23:06:48 +00:00
if (args.contains('--verbose')) {
stderr.writeln(st);
}
2018-07-14 22:54:38 +00:00
}
2019-04-29 17:41:35 +00:00
exitCode = 1;
}).whenComplete(() {
stdout.write(resetAll.wrap(''));
2016-09-14 04:33:28 +00:00
});
}
2018-07-14 23:13:32 +00:00
const String asciiArt = '''
____________ ________________________
___ |__ | / /_ ____/__ ____/__ /
__ /| |_ |/ /_ / __ __ __/ __ /
_ ___ | /| / / /_/ / _ /___ _ /___
/_/ |_/_/ |_/ \____/ /_____/ /_____/
''';