| // Copyright 2017 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| import 'package:args/args.dart' as argslib; |
| import 'package:meta/meta.dart'; |
| void exitWithError(String errorMessage) { |
| if (errorMessage == null) |
| stderr.writeln('Fatal Error: $errorMessage'); |
| void checkCwdIsRepoRoot(String commandName) { |
| final bool isRepoRoot = new Directory('.git').existsSync(); |
| '$commandName must be run from the root of the Flutter repository. The ' |
| 'current working directory is: ${Directory.current.path}' |
| GeneratorOptions parseArgs(List<String> rawArgs) { |
| final argslib.ArgParser argParser = new argslib.ArgParser() |
| final argslib.ArgResults args = argParser.parse(rawArgs); |
| final bool writeToFile = args['overwrite']; |
| return new GeneratorOptions(writeToFile: writeToFile); |
| @required this.writeToFile, |