@puls-atlas/cli
Version:
The Puls Atlas CLI tool for managing Atlas projects
34 lines • 976 B
JavaScript
import inquirer from 'inquirer';
import { selectProject } from '../../../utils/index.js';
import { initializeCollection } from './initialize.js';
import { manageCollection } from './manage.js';
export default (options = {}) => {
const {
destination = 'BigQuery'
} = options;
switch (destination.toLowerCase()) {
case 'bigquery':
return manageBigQuery(options);
default:
throw new Error('Unknown destination. Possible value is `BigQuery`.');
}
};
const manageBigQuery = async options => {
const {
projectId
} = await selectProject('.firebaserc');
const {
operation
} = await inquirer.prompt([{
type: 'select',
name: 'operation',
message: 'Do you want to manage an existing export or create a new one?',
choices: ['Manage', 'Create']
}]);
switch (operation) {
case 'Create':
return initializeCollection(projectId, options);
case 'Manage':
return manageCollection(projectId, options);
}
};