I have the following code
export const program = new Command();
program.version('0.0.1');
program
mand('groups')
mand('create')
.action(() => console.log('creating'))
mand('delete')
.action(() => console.log('deleting-all'))
program.parse(process.argv)
What I want to achieve is something like
groups create
and groups delete
The code however chains that delete to the create. It recognizes groups create
and groups create delete
(which I dont want) but does not recognize the groups delete
I have the following code
export const program = new Command();
program.version('0.0.1');
program
.mand('groups')
.mand('create')
.action(() => console.log('creating'))
.mand('delete')
.action(() => console.log('deleting-all'))
program.parse(process.argv)
What I want to achieve is something like
groups create
and groups delete
The code however chains that delete to the create. It recognizes groups create
and groups create delete
(which I dont want) but does not recognize the groups delete
1 Answer
Reset to default 11You want to add the delete
submand to the groups
mand. e.g.
const { Command } = require('mander');
const program = new Command();
program.version('0.0.1');
const groups = program
.mand('groups');
groups
.mand('create')
.action(() => console.log('creating'))
groups
.mand('delete')
.action(() => console.log('deleting-all'))
program.parse(process.argv)
The related example file is: https://github./tj/mander.js/blob/master/examples/nestedCommands.js
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744057146a4551113.html
评论列表(0条)