mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

* remove locale "sd" (not supported by ICU/CLDR); unify localizations scripts CLI * address comments
46 lines
1.1 KiB
Dart
46 lines
1.1 KiB
Dart
// 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 'dart:io';
|
|
|
|
import 'package:args/args.dart' as argslib;
|
|
import 'package:meta/meta.dart';
|
|
|
|
void fatal(String message) {
|
|
stderr.writeln(message);
|
|
exit(1);
|
|
}
|
|
|
|
void checkCwdIsRepoRoot(String commandName) {
|
|
final bool isRepoRoot = new Directory('.git').existsSync();
|
|
|
|
if (!isRepoRoot) {
|
|
fatal(
|
|
'$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()
|
|
..addFlag(
|
|
'overwrite',
|
|
abbr: 'w',
|
|
defaultsTo: false,
|
|
);
|
|
final argslib.ArgResults args = argParser.parse(rawArgs);
|
|
final bool writeToFile = args['overwrite'];
|
|
|
|
return new GeneratorOptions(writeToFile: writeToFile);
|
|
}
|
|
|
|
class GeneratorOptions {
|
|
GeneratorOptions({
|
|
@required this.writeToFile,
|
|
});
|
|
|
|
final bool writeToFile;
|
|
}
|