0.0.3 • Published 1 year ago

cli-eleven v0.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

eleven

Effortlessly build command line apps, with compile and run time type-safety by default

:sparkles: Features

Fully typed arguments in runtime and dev

Minimal and simple API

  • No sub-commands

Supported types for flags

  • string
  • number
  • boolean
  • enum (todo)

Auto-complete (todo)

Automatic runtime type validation and error messages

Automatic help and version generation by default (todo)

Navigate help section interactively (todo) (optional)

Message when CLI version is outdated (todo) (optional)

Use: https://github.com/sindresorhus/latest-version

Runs in a separate thread to now slow down main functionality

Hints when command is misspelled

Watch mode (todo)

See how changes to your CLI immediately updates the help section

Color output (todo)

Can be turned off with flag or environment variable

Example usage

import { command, run } from 'cli-eleven'

const commands = [
  command({
    name: 'hello',
    flag: {
      world: { type: 'string' },
    },
    run({ world }) {
      console.log(world)
    },
  }),
]

run(commands)

API

command

name

string

run

(runtimeValues) => void

flag

Record<string, Flag>

flag: {
  hello: {
    type: 'string'
  }
}
type

'string' | 'number' | 'boolean'

defaultValue?

string | number | boolean

description?

string

alias?

string

Install

npm install cli-eleven
0.0.3

1 year ago

0.0.2

1 year ago