forked from fanruan/fineui
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
453 B
21 lines
453 B
#!/usr/bin/env node |
|
const yargs = require('yargs/yargs'); |
|
const { hideBin } = require('yargs/helpers'); |
|
|
|
const workerCmd = require('./worker/cli.worker'); |
|
|
|
const argv = yargs(hideBin(process.argv)).argv; |
|
|
|
const cmd = argv._[0]; |
|
|
|
const cmds = new Map([ |
|
['worker', workerCmd], |
|
]); |
|
|
|
if (!cmd) throw new Error('Command is undefined!'); |
|
|
|
if (cmds.has(cmd)) { |
|
cmds.get(cmd)?.exec(argv); |
|
} else { |
|
throw new Error(`Command ${cmd} not supported`); |
|
}
|
|
|