-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix misleading typing for options.json. #9275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
81a3962
9586645
30fa19b
ad4aa52
818f28a
c20e771
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,19 @@ | ||
import { Command } from "../command"; | ||
import { logger } from "../logger"; | ||
import { requirePermissions } from "../requirePermissions"; | ||
import { Emulators } from "../emulator/types"; | ||
import { warnEmulatorNotSupported } from "../emulator/commandUtils"; | ||
import { FirestoreOptions } from "../firestore/options"; | ||
import { Backup, getBackup } from "../gcp/firestore"; | ||
import { PrettyPrint } from "../firestore/pretty-print"; | ||
|
||
export const command = new Command("firestore:backups:get <backup>") | ||
.description("get a Cloud Firestore database backup") | ||
.before(requirePermissions, ["datastore.backups.get"]) | ||
.before(warnEmulatorNotSupported, Emulators.FIRESTORE) | ||
.action(async (backupName: string, options: FirestoreOptions) => { | ||
.action(async (backupName: string) => { | ||
const backup: Backup = await getBackup(backupName); | ||
const printer = new PrettyPrint(); | ||
|
||
if (options.json) { | ||
logger.info(JSON.stringify(backup, undefined, 2)); | ||
} else { | ||
printer.prettyPrintBackup(backup); | ||
} | ||
printer.prettyPrintBackup(backup); | ||
|
||
return backup; | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import { Command } from "../command"; | ||
import { logger } from "../logger"; | ||
import { requirePermissions } from "../requirePermissions"; | ||
import { Emulators } from "../emulator/types"; | ||
import { warnEmulatorNotSupported } from "../emulator/commandUtils"; | ||
|
@@ -23,17 +22,15 @@ export const command = new Command("firestore:backups:list") | |
const listBackupsResponse: ListBackupsResponse = await listBackups(options.project, location); | ||
const backups: Backup[] = listBackupsResponse.backups || []; | ||
|
||
if (options.json) { | ||
logger.info(JSON.stringify(listBackupsResponse, undefined, 2)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This branch isn't consistent with the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That was indeed the intention. It's possible that I didn't notice this when this was implemented the first time... sorry. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No problem. The next major (breaking) release of the CLI should be coming up soon and feel free to make it return |
||
} else { | ||
printer.prettyPrintBackups(backups); | ||
if (listBackupsResponse.unreachable && listBackupsResponse.unreachable.length > 0) { | ||
logWarning( | ||
"We were not able to reach the following locations: " + | ||
listBackupsResponse.unreachable.join(", "), | ||
); | ||
} | ||
printer.prettyPrintBackups(backups); | ||
if (listBackupsResponse.unreachable && listBackupsResponse.unreachable.length > 0) { | ||
logWarning( | ||
"We were not able to reach the following locations: " + | ||
listBackupsResponse.unreachable.join(", "), | ||
); | ||
} | ||
|
||
// TODO: Consider returning listBackupResponse instead for --json. This will | ||
// be a breaking change but exposes .unreachable, not just .backups. | ||
return backups; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The VSCE right now doesn't call Firestore commands. So I believe this should be a noop.