firebase-tools-extra
Version:
Extra functionality for firebase-tools with support for emulators and auth through service account.
29 lines (28 loc) • 1.47 kB
JavaScript
import { rtdbGet } from '../actions/rtdb';
/**
* @name databaseGet
* fetch and print JSON data at the specified path from database emulator
* @param {object} program - Commander program
*/
export default function databaseGetCommand(program) {
program
.command('database:get <path>')
.description('fetch and print JSON data at the specified path from database emulator')
// .option('--shallow', 'return shallow response')
.option('--pretty', 'pretty print response')
.option('--order-by <key>', 'select a child key by which to order results')
.option('--order-by-key', 'order by key name')
.option('--order-by-value', 'order by primitive value')
.option('--limit-to-first <num>', 'limit to the first <num> results')
.option('--limit-to-last <num>', 'limit to the last <num> results')
.option('--start-at <val>', 'start results at <val> (based on specified ordering)')
.option('--end-at <val>', 'end results at <val> (based on specified ordering)')
.option('--equal-to <val>', 'restrict results to <val> (based on specified ordering)')
.option('--emulator', 'use RTDB emulator')
.option('--debug', 'print verbose debug output to console')
.action(function (dbPath, options) {
return rtdbGet(dbPath, options)
.then(function () { return process.exit(0); })
.catch(function () { return process.exit(1); });
});
}