Helper for handling commands with peowly
import { peowlyCommands } from 'peowly-commands';
await peowlyCommands(
{
foo: {
description: 'Do something very foo-like',
async run (argv, importMeta, { parentName }) {
// Do whatever you like, eg. initiate a peowly, peowly-commands, meow or something else
}
}
},
{
aliases: {
fs: {
description: 'Alias for "foo --strict"',
argv: ['foo', '--strict']
},
},
argv: process.argv.slice(2),
name: 'name-of-cli',
importMeta: import.meta
}
)
See example
-folder
peowlyCommands(commands: CliCommands, options: CliOptions, meta?: PeowlyMeta | undefined): Promise<void>
Thrown when peowlyCommands()
is given a command that it can not find. Comes with a commandName
property and a showHelp()
function. The latter works like the showHelp()
of peowly
-
argsclopts
– also concerned with helpers aroundparseArgs
-
meow
– the inspiration forpeowly
– and name inspiration (p
as inparseArgs
,eow
as inmeow
,ly
to avoid being perceived as a typejacking) -
meow-with-subcommands
– the original version of this module and what evolved intopeowly
andpeowly-commands
-
peowly
– the parser module that this module builds on
-
parseArgs()
– the node.js API this module is built around. Available sincev18.3.0
andv16.17.0
, non-experimental sincev20.0.0
.