UNPKG

firebase-tools-extra

Version:

Extra functionality for firebase-tools with support for emulators and auth through service account.

20 lines (19 loc) 939 B
import { firestoreWrite } from '../actions/firestore'; /** * @name firestoreAdd * Add data to specified collection or sub-collection of Firestore. Work for both hosted and emulated environments * @param {object} program - Commander program */ export default function firestoreAddCommand(program) { program .command('firestore:add <path> [infile]') .description('Add data to specified collection or sub-collection of Firestore. Work for both hosted and emulated environments') .option('-d, --data <data>', 'specify escaped JSON directly') .option('--emulator', 'use Firestore emulator') .option('--debug', 'print verbose debug output to console') .action(function (dbPath, inFile, options) { return firestoreWrite('add', dbPath, inFile, options) .then(function () { return process.exit(0); }) .catch(function () { return process.exit(1); }); }); }