commander-shepard
v3.0.4
Published
Little framework for building command line tools
Downloads
45
Maintainers
Readme
Commander Shepard
Framework for developing node CLI.
yarn add commander-shepard --save
Usage
import { Commander, Command } from 'commander-shepard'
const commander = new Commander({
key: 'commander',
package: require('../package.json'),
handler: ({ commands }) => {
// do something
},
flags: [
{
required: true,
keys: ['f', 'foo-flag'],
description: 'f flag description',
},
],
commands: [
{
required: true,
key: 'foo argument',
description: 'required first arg',
},
],
})
const fooSubcommand = new Command({
handler: async ({ commands }) => {
// do something
},
})
fooSubcommand.use('bar', new Command({
handler: ({ commands }) => {
// do something
},
}))
commander.use('foo', fooSubcommand)
commander.start()
.catch((e) => {
console.error('error', e.message)
})