in firestore-bigquery-export/scripts/import/src/config.ts [150:199]
export async function parseConfig(): Promise<CliConfig> {
program.parse(process.argv);
if (program.nonInteractive) {
if (
program.project === undefined ||
program.sourceCollectionPath === undefined ||
program.dataset === undefined ||
program.tableNamePrefix === undefined ||
program.queryCollectionGroup === undefined ||
program.batchSize === undefined ||
program.datasetLocation === undefined ||
program.multiThreaded === undefined ||
!validateBatchSize(program.batchSize)
) {
program.outputHelp();
process.exit(1);
}
return {
projectId: program.project,
sourceCollectionPath: program.sourceCollectionPath,
datasetId: program.dataset,
tableId: program.tableNamePrefix,
batchSize: program.batchSize,
queryCollectionGroup: program.queryCollectionGroup === "true",
datasetLocation: program.datasetLocation,
multiThreaded: program.multiThreaded === "true",
};
}
const {
project,
sourceCollectionPath,
dataset,
table,
batchSize,
queryCollectionGroup,
datasetLocation,
multiThreaded,
} = await inquirer.prompt(questions);
return {
projectId: project,
sourceCollectionPath: sourceCollectionPath,
datasetId: dataset,
tableId: table,
batchSize: batchSize,
queryCollectionGroup: queryCollectionGroup,
datasetLocation: datasetLocation,
multiThreaded: multiThreaded,
};
}