Skip to content

Commit 38ef941

Browse files
authored
dev/bots/prepare_packages: cleanup (#113717)
1 parent 83a9858 commit 38ef941

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

dev/bots/prepare_package.dart

+3-14
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,6 @@ class PreparePackageException implements Exception {
5555
enum Branch {
5656
beta,
5757
stable;
58-
59-
static Branch fromName(String name) {
60-
switch (name) {
61-
case 'beta':
62-
return Branch.beta;
63-
case 'stable':
64-
return Branch.stable;
65-
default:
66-
throw ArgumentError('Invalid branch name.');
67-
}
68-
}
6958
}
7059

7160
/// A helper class for classes that want to run a process, optionally have the
@@ -860,10 +849,10 @@ Future<void> main(List<String> rawArguments) async {
860849
exit(exitCode);
861850
}
862851

863-
final String revision = parsedArguments['revision'] as String;
864852
if (!parsedArguments.wasParsed('revision')) {
865853
errorExit('Invalid argument: --revision must be specified.');
866854
}
855+
final String revision = parsedArguments['revision'] as String;
867856
if (revision.length != 40) {
868857
errorExit('Invalid argument: --revision must be the entire hash, not just a prefix.');
869858
}
@@ -872,7 +861,7 @@ Future<void> main(List<String> rawArguments) async {
872861
errorExit('Invalid argument: --branch must be specified.');
873862
}
874863

875-
final String tempDirArg = parsedArguments['temp_dir'] as String;
864+
final String? tempDirArg = parsedArguments['temp_dir'] as String?;
876865
Directory tempDir;
877866
bool removeTempDir = false;
878867
if (tempDirArg == null || tempDirArg.isEmpty) {
@@ -897,7 +886,7 @@ Future<void> main(List<String> rawArguments) async {
897886

898887
final bool publish = parsedArguments['publish'] as bool;
899888
final bool dryRun = parsedArguments['dry_run'] as bool;
900-
final Branch branch = Branch.fromName(parsedArguments['branch'] as String);
889+
final Branch branch = Branch.values.byName(parsedArguments['branch'] as String);
901890
final ArchiveCreator creator = ArchiveCreator(
902891
tempDir,
903892
outputDir,

0 commit comments

Comments
 (0)