platform-cli/bin/angel3.dart

84 lines
2.4 KiB
Dart
Raw Normal View History

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(
2021-07-18 08:00:08 +00:00
'angel3',
2021-07-17 05:10:35 +00:00
asciiArt +
2018-07-14 23:13:32 +00:00
'\n\n' +
2021-07-17 05:10:35 +00:00
'Command-line tools for the Angel3 framework.' +
2018-07-14 23:13:32 +00:00
'\n\n' +
2021-07-17 05:10:35 +00:00
'https://angel3-framework.web.app');
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
2021-07-17 05:10:35 +00:00
const String asciiArt2 = '''
___ _ ________________ _____
/ | / | / / ____/ ____/ / |__ /
/ /| | / |/ / / __/ __/ / / /_ <
/ ___ |/ /| / /_/ / /___/ /______/ /
/_/ |_/_/ |_/\\____/_____/_____/____/
''';
2018-07-14 23:13:32 +00:00
const String asciiArt = '''
2021-07-17 05:10:35 +00:00
_ _ _ ____ _____ _ _____
/ \\ | \\ | |/ ___| ____| | |___ /
/ _ \\ | \\| | | _| _| | | |_ \\
/ ___ \\| |\\ | |_| | |___| |___ ___) |
/_/ \\_\\_| \\_|\\____|_____|_____|____/
''';
const String asciiArt3 = '''
\ \ | ___| ____| | ___ /
_ \ \ | | __| | _ \
___ \ |\ | | | | | ) |
_/ _\ _| \_| \____| _____| _____| ____/
''';
const String asciiArtOld = '''
2018-07-14 23:13:32 +00:00
____________ ________________________
___ |__ | / /_ ____/__ ____/__ /
__ /| |_ |/ /_ / __ __ __/ __ /
_ ___ | /| / / /_/ / _ /___ _ /___
/_/ |_/_/ |_/ \____/ /_____/ /_____/
''';