Add Flags class. (#12268)

This class lives in the Context and allows callers to "inject"
flag values, where flag values are first extracted from the
command arguments, then from the global arguments as a fallback.
This commit is contained in:
Todd Volkert
2017-09-28 09:36:55 -07:00
committed by GitHub
parent efb45ea788
commit 9ea1ff12d7
3 changed files with 169 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ import '../artifacts.dart';
import '../base/common.dart';
import '../base/context.dart';
import '../base/file_system.dart';
import '../base/flags.dart';
import '../base/logger.dart';
import '../base/os.dart';
import '../base/platform.dart';
@@ -163,6 +164,8 @@ class FlutterCommandRunner extends CommandRunner<Null> {
@override
Future<Null> runCommand(ArgResults globalResults) async {
context.setVariable(Flags, new Flags(globalResults));
// Check for verbose.
if (globalResults['verbose']) {
// Override the logger.