Use yargs
This commit is contained in:
parent
31c01e0a6b
commit
3e991cc2f1
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/node
|
#!/bin/node
|
||||||
const { createApp, getTable, createRow, createTable } = require("./utils")
|
const yargs = require("yargs")
|
||||||
|
|
||||||
const Chance = require("chance")
|
const Chance = require("chance")
|
||||||
|
|
||||||
|
@ -8,10 +8,9 @@ const generator = new Chance()
|
||||||
const STUDENT_COUNT = 500
|
const STUDENT_COUNT = 500
|
||||||
const SUBJECT_COUNT = 10
|
const SUBJECT_COUNT = 10
|
||||||
|
|
||||||
if (!process.argv[2]) {
|
const { apiKey, appId } = require("yargs")
|
||||||
console.error("Please specify an API key as script argument.")
|
.demandOption(["apiKey"])
|
||||||
process.exit(-1)
|
.option("appId").argv
|
||||||
}
|
|
||||||
|
|
||||||
const start = Date.now()
|
const start = Date.now()
|
||||||
async function batchCreate(apiKey, appId, table, items, batchSize = 1000) {
|
async function batchCreate(apiKey, appId, table, items, batchSize = 1000) {
|
||||||
|
@ -64,7 +63,6 @@ async function batchCreate(apiKey, appId, table, items, batchSize = 1000) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
const apiKey = process.argv[2]
|
|
||||||
const app = await createApp(apiKey)
|
const app = await createApp(apiKey)
|
||||||
console.log(`App created: http://localhost:10000/builder/app/${app._id}`)
|
console.log(`App created: http://localhost:10000/builder/app/${app._id}`)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue