Setup subcommands with yargs
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import yargs, { Arguments } from 'yargs';
|
||||
|
||||
export const command = 'start';
|
||||
|
||||
export const desc = 'Start local CNS.';
|
||||
|
||||
exports.builder = {
|
||||
'log-file': {
|
||||
type: 'string'
|
||||
}
|
||||
}
|
||||
|
||||
exports.handler = function (argv: Arguments) {
|
||||
const { logFile } = argv;
|
||||
|
||||
console.log('option logFile', logFile)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import yargs from 'yargs';
|
||||
|
||||
export const command = 'cns';
|
||||
|
||||
export const desc = 'CNS tools';
|
||||
|
||||
exports.builder = (yargs: yargs.Argv) => {
|
||||
return yargs.commandDir('cns-cmds')
|
||||
}
|
||||
Reference in New Issue
Block a user