cli-eleven
v0.0.3
Published
Effortlessly build command line apps, with compile and run time type-safety by default
Downloads
6
Readme
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