clerc
clerc copied to clipboard
🖖🏻 Clerc: The full-featured cli library.

Clerc is a full-featured library (tool set) for building CLI Apps in Node.js, Deno or Bun.
- ✨ Features
- 😊 The simplest CLI example
- 📖 Documentation
- 🦄 Examples
- 🤔 More...
[!NOTE]
This package is ESM-only.
✨ Features
- Lightweight - Dependencies are bundled and minified
- Plugin system - Add rich features on demand.
- Chainable APIs - Composable.
- Developer friendly - Strongly typed, converts flags and parameters to camelCase.
- Parses parameters - No need to read them by yourself.
- I18N - Easy to change different locales.
😊 The simplest CLI example
Install clerc, and create a file named cli.mjs:
import { Clerc } from "clerc";
Clerc.create(
"foo", // CLI Name
"A foo CLI", // CLI Description
"0.0.0", // CLI Version
)
.command(
"bar", // Command name
"A bar command", // Command description
)
.on(
"bar",
(
_ctx, // The command context, but we haven't used it yet
) => {
console.log("Hello, world from Clerc.js!");
},
)
.parse(); // Parse the arguments and run!
Then run: node cli.mjs bar. It should log in your shell: Hello, world from Clerc.js!
📖 Documentation
Please see https://clerc.js.org.
🦄 Examples
Check the examples made with Clerc.js:
- Greeting - The example from above
- Bumpp - Reimplementation of
Bumpp's CLI
🤔 More...
Why using Clerc?
Clerc uses type-flag to parse arguments. It is strongly-typed, which brings you better DX. It is powerful(supports custom type) and quite small!
And clerc uses lite-emit to emit events. It is a event emitter library but with better type support.
The whole bundled and minified @clerc/core package is only 10KB (ignored types), which is much smaller than yargs, commander, CAC and oclif :)
Why naming "Clerc"?
Hiroki Osame's cleye is an awesome tool for building CLI apps. Its name sounds quite nice, so I also found an English name Clerc for this package =)
📝 License
MIT. Made with ❤️ by Ray