@auzmartist/sealei
v0.1.6
Published
> Pronounced "CLI"
Downloads
8
Readme
Sealei
Pronounced "CLI"
Tools for creating nested CLI commands with argument narrowing.
import { CLIConfig, sealei } from '@auzmartist/sealei'
const argv = yargs(process.argv).argv
sealei<{
// describes the arguments and results (optional) of each command
foobar: [{ foo: string; bar: string }, Promise<string>]
childCLI: [{}]
}>('cli', {
// strongly typed configuration for argument narrowing
// autogenerated documentation
// validation of arguments
foobar: {
description: 'Concatenate foo and bar',
example: 'cli foobar -f "foo" -b "bar"',
args: {
foo: { aka: ['f'] },
bar: { aka: ['b'] },
},
strict: true, // ensures (f)oo and (b)ar are not undefined
command: ({ foo, bar }) => `${foo}${bar}`,
},
childCLI: sealei<any>(/* child CLI */),
})(argv)