meow-with-subcommands
v1.3.0
Published
Helper for handling subcommands with meow
Downloads
4
Readme
meow-with-subcommands
Helper for handling subcommands with meow
Usage
Basic
import { meowWithSubcommands } from 'meow-with-subcommands';
await meowWithSubcommands(
{
foo: {
description: 'Do something very foo-like',
async run (argv, importMeta, { parentName }) {
// Do whatever you like, eg. initiate a new meow or meow-with-subcommands
}
}
},
{
aliases: {
fs: {
description: 'Alias for "foo --strict"',
argv: ['foo', '--strict']
},
},
argv: process.argv.slice(2),
name: 'name-of-cli',
importMeta: import.meta
}
)
Complete
See example
-folder
API
meowWithSubcommands(commands, { [aliases], argv, name, ...meowOptions }) => Promise<void>
prepareFlags
printFlagList
printHelpList
Extracted from
SocketDev/socket-cli-js
– I found the pattern I created for this open source CLI to be quite helpful and wanted to reuse it