firebaseInitializationAccountArguments function
Selects the existing Firebase CLI account for automated initialization.
Implementation
List<String> firebaseInitializationAccountArguments(String output) {
final normalized = output.replaceAll(_ansiEscapePattern, "");
final account = RegExp(r"^Logged in as ([^\s]+@[^\s]+)\s*$", multiLine: true)
.firstMatch(normalized)
?.group(1);
if (account != null) {
return ["--account", account];
}
if (normalized.contains("No authorized accounts")) {
return [];
}
throw const FormatException(
"Cannot determine the current Firebase CLI account. Check firebase login:list.");
}