mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add verbose flag to sky_tools and basic logging capabilities.
This commit is contained in:
parent
e6b45c5023
commit
5678c12433
@ -5,17 +5,27 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:args/args.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:sky_tools/src/common.dart';
|
||||
import 'package:sky_tools/src/init.dart';
|
||||
import 'package:sky_tools/src/install.dart';
|
||||
|
||||
void main(List<String> args) {
|
||||
Logger.root.level = Level.WARNING;
|
||||
Logger.root.onRecord.listen((LogRecord rec) {
|
||||
print('${rec.level.name}: ${rec.message}');
|
||||
});
|
||||
|
||||
Map<String, CommandHandler> handlers = {};
|
||||
|
||||
ArgParser parser = new ArgParser();
|
||||
parser.addSeparator('options:');
|
||||
parser.addFlag('help',
|
||||
abbr: 'h', negatable: false, help: 'Display this help message.');
|
||||
parser.addFlag('verbose',
|
||||
abbr: 'v',
|
||||
negatable: false,
|
||||
help: 'Noisy logging, including all shell commands executed.');
|
||||
parser.addSeparator('commands:');
|
||||
|
||||
for (CommandHandler handler in [
|
||||
@ -35,6 +45,10 @@ void main(List<String> args) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (results['verbose']) {
|
||||
Logger.root.level = Level.INFO;
|
||||
}
|
||||
|
||||
if (results['help']) {
|
||||
_printUsage(parser, handlers);
|
||||
} else if (results.command != null) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user