firebase-tools-extra
Version:
Extra functionality for firebase-tools with support for emulators and auth through service account.
24 lines (23 loc) • 1.29 kB
JavaScript
import { firestoreDelete } from '../actions/firestore';
/**
* @name firestoreDelete
* Delete data from Cloud Firestore. Works for both hosted and emulated environments
* @param {object} program - Commander program
*/
export default function firestoreDeleteCommand(program) {
program
.command('firestore:delete <path>')
.description('Delete data from Cloud Firestore. Works for both hosted and emulated environments')
.option('--shallow', 'Shallow. Delete only parent documents and ignore documents in subcollections. Any action which would orphan documents will fail if this argument is not passed. May not be passed along with -r.')
// .option(
// '-r, --recursive',
// 'Recursive. Delete all documents and subcollections. Any action which would result in the deletion of child documents will fail if this argument is not passed. May not be passed along with --shallow.'
// )
.option('--emulator', 'use Firestore emulator')
.option('--debug', 'print verbose debug output to console')
.action(function (dbPath, options) {
return firestoreDelete(dbPath, options)
.then(function () { return process.exit(0); })
.catch(function () { return process.exit(1); });
});
}