0.19.1 • Published 2 months ago
@eegli/tinyparse v0.19.1
Tinyparse
A tiny, type-safe and flexible utility for creating command line tools in Node.js
What it is
Like oclif and Yargs had a baby.
import { Parser } from '@eegli/tinyparse';
new Parser()
.option('occasion', {
longFlag: '--occasion',
shortFlag: '-o',
defaultValue: '',
required: true,
})
.subcommand('congratulate', {
args: ['name'] as const,
handler: ({ args, options }) => {
const [name] = args;
const { occasion } = options;
console.log(`Happy ${occasion}, ${name}!`);
},
})
.defaultHandler(() => {
console.log('Please enter your name');
})
.parse(['congratulate', 'John', '--occasion', 'birthday'])
.call();
// Happy birthday, John!
I use this mostly for other pet projects of mine so it comes with some opinions 🤪.
Features
- TypeScript first - 100% type-safety
- Supports subcommands and flag options
- Async API
- Lightweight - Zero dependencies
- Mega customizable
Examples
- Check out the extensive test suites or
- Play in the dedicated Code Sandbox
Resources
This project has been guided by the amazing Command Line Interface Guidelines by Aanand Prasad, Ben Firshman, Carl Tashian and Eva Parish.
Further inspiration has been taken from the Apache Commons CLI.
0.19.1
2 months ago
0.19.0
2 months ago
0.18.3
3 months ago
0.18.2
3 months ago
0.18.1
3 months ago
0.16.0
3 months ago
0.17.0
3 months ago
0.18.0
3 months ago
0.17.1
3 months ago
0.15.0
5 months ago
0.15.1
5 months ago
0.12.0
1 year ago
0.13.0
1 year ago
0.14.0
1 year ago
0.10.0
1 year ago
0.11.0
1 year ago
0.9.0
1 year ago
0.8.0
1 year ago
0.7.1
1 year ago
0.7.0
2 years ago
0.6.0
2 years ago
0.5.1
2 years ago
0.5.0
2 years ago
0.4.0
2 years ago
0.3.0
2 years ago
0.2.0
2 years ago
0.1.1
2 years ago
0.1.0
2 years ago
0.0.1-1
2 years ago
0.0.1-0
2 years ago