firebase-tools-extra
Version:
Extra functionality for firebase-tools with support for emulators and auth through service account.
32 lines (31 loc) • 1.58 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var rtdb_1 = require("../actions/rtdb");
/**
* @name databaseGet
* fetch and print JSON data at the specified path from database emulator
* @param {object} program - Commander program
*/
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 rtdb_1.rtdbGet(dbPath, options)
.then(function () { return process.exit(0); })
.catch(function () { return process.exit(1); });
});
}
exports.default = databaseGetCommand;