@auzmartist/sealei
TypeScript icon, indicating that this package has built-in type declarations

0.1.6 • Public • Published

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)

Readme

Keywords

none

Package Sidebar

Install

npm i @auzmartist/sealei

Weekly Downloads

0

Version

0.1.6

License

none

Unpacked Size

7.8 kB

Total Files

4

Last publish

Collaborators

  • auzmartist