2016-07-05 21:20:01 +00:00
|
|
|
#!/usr/bin/env dart
|
2016-07-05 21:19:02 +00:00
|
|
|
|
2021-06-11 05:07:53 +00:00
|
|
|
library angel3_cli.tool;
|
|
|
|
|
|
|
|
import 'dart:io';
|
|
|
|
import 'package:args/command_runner.dart';
|
|
|
|
import 'package:angel3_cli/angel3_cli.dart';
|
2019-04-29 17:41:35 +00:00
|
|
|
import 'package:io/ansi.dart';
|
2016-07-05 21:19:02 +00:00
|
|
|
|
2021-06-11 05:07:53 +00:00
|
|
|
final String DOCTOR = 'doctor';
|
2016-09-14 04:33:28 +00:00
|
|
|
|
2021-06-11 05:07:53 +00:00
|
|
|
void main(List<String> args) async {
|
|
|
|
var runner = CommandRunner(
|
|
|
|
'angel',
|
2018-07-14 23:13:32 +00:00
|
|
|
asciiArt.trim() +
|
|
|
|
'\n\n' +
|
2021-06-11 05:07:53 +00:00
|
|
|
'Command-line tools for the Angel framework.' +
|
2018-07-14 23:13:32 +00:00
|
|
|
'\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
|
2021-06-11 05:07:53 +00:00
|
|
|
..addCommand(DeployCommand())
|
|
|
|
..addCommand(DoctorCommand())
|
|
|
|
..addCommand(KeyCommand())
|
|
|
|
..addCommand(InitCommand())
|
|
|
|
..addCommand(InstallCommand())
|
|
|
|
..addCommand(RenameCommand())
|
|
|
|
..addCommand(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 {
|
2021-06-11 05:07:53 +00:00
|
|
|
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 = '''
|
|
|
|
____________ ________________________
|
|
|
|
___ |__ | / /_ ____/__ ____/__ /
|
|
|
|
__ /| |_ |/ /_ / __ __ __/ __ /
|
|
|
|
_ ___ | /| / / /_/ / _ /___ _ /___
|
|
|
|
/_/ |_/_/ |_/ \____/ /_____/ /_____/
|
|
|
|
|
|
|
|
''';
|