opendb_test_rpc
Version:
general purpose library for OpenDB blockchain
42 lines (39 loc) • 1.09 kB
text/typescript
// tslint:disable:no-expression-statement no-console
import chalk from 'chalk'
import { checkArgs, showHelp } from './args'
import { inquireKeystore } from './inquire'
import { getIntro, OpenDBiOptions, hasCliOptions } from './utils'
;(async () => {
const argInfo = await checkArgs()
// const options: OpenDBiOptions = hasCliOptions(argInfo)
// ? argInfo
// : {
// ...(await (async () => {
// console.log(getIntro())
// showHelp(0)
// return null
// })()),
// // TSES-lint: to change {} - unknown
// ...(argInfo as {}),
// }
let options: OpenDBiOptions
if (hasCliOptions(argInfo)) {
options = argInfo
} else {
const intro = await (async () => {
console.log(getIntro())
showHelp(0)
return null
})()
options = { ...intro, ...(argInfo as Record<string, unknown>) }
}
// following logic base on current options and inputs
if (options.keystore) {
inquireKeystore()
}
})().catch((err: Error) => {
console.error(`
${chalk.red(err.message)}
`)
process.exit(1)
})