feat:yoyo-getfastmirror(dart)

yoyo-getfastmirror的dart版本,易扩展
This commit is contained in:
Riceneeder
2023-01-30 13:53:05 +08:00
parent 887b5b967f
commit a336f92cbf
26 changed files with 864 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
import 'dart:io';
import 'package:yoyo_get_fast_mirror/src/command_runner.dart';
Future<void> main(List<String> args) async {
await _flushThenExit(await YoyoGetFastMirrorCommandRunner().run(args));
}
/// Flushes the stdout and stderr streams, then exits the program with the given
/// status code.
///
/// This returns a Future that will never complete, since the program will have
/// exited already. This is useful to prevent Future chains from proceeding
/// after you've decided to exit.
Future<void> _flushThenExit(int status) {
return Future.wait<void>([stdout.close(), stderr.close()])
.then<void>((_) => exit(status));
}