subcommands
This is yet another combinator, which takes a couple of commands and produce a new command that the first argument will choose between them.
Config
name(required): A name for the containerversion: The container versioncmds: An object where the keys are the names of the subcommands to use, and the values arecommandinstances. You can also providesubcommandsinstances to nest a nested subcommand!
Usage
import { command, subcommands, run } from 'cmd-ts';
const cmd1 = command({
/* ... */
});
const cmd2 = command({
/* ... */
});
const subcmd1 = subcommands({
name: 'my subcmd1',
cmds: { cmd1, cmd2 },
});
const nestingSubcommands = subcommands({
name: 'nesting subcommands',
cmds: { subcmd1 },
});
run(nestingSubcommands, process.argv.slice(2));