Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/clercjs/clerc
🖖🏻 Clerc: The full-featured cli library.
https://github.com/clercjs/clerc
argparse args argument-parser argument-parsing arguments argv cac clerc cli cli-application cli-framework command-line command-line-tool commandline commandline-apps minimist node nodejs parse yargs
Last synced: 6 days ago
JSON representation
🖖🏻 Clerc: The full-featured cli library.
- Host: GitHub
- URL: https://github.com/clercjs/clerc
- Owner: clercjs
- License: mit
- Created: 2022-09-04T07:43:32.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-29T22:31:01.000Z (10 days ago)
- Last Synced: 2024-10-30T00:44:53.836Z (10 days ago)
- Topics: argparse, args, argument-parser, argument-parsing, arguments, argv, cac, clerc, cli, cli-application, cli-framework, command-line, command-line-tool, commandline, commandline-apps, minimist, node, nodejs, parse, yargs
- Language: TypeScript
- Homepage: https://clerc.js.org
- Size: 3.6 MB
- Stars: 118
- Watchers: 1
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-cli-frameworks - Clerc - featured library for building CLI Apps in Node.js, Deno or Bun. It's strongly-typed, easy-to-use and flexible. ([JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript) / Useful awesome list for Go cli)
- awesome-javascript - @clerc/monorepo - featured cli library. (Packages)
- awesome-javascript - @clerc/monorepo - featured cli library. (Packages)
README
![Clerc Card](.github/assets/ClercCard.png)
Clerc is a full-featured library (tool set) for building CLI Apps in Node.js, Deno or Bun.[![Version](https://img.shields.io/npm/v/clerc.svg)](https://npmjs.org/package/clerc)
[![CI](https://github.com/clercjs/clerc/actions/workflows/ci.yml/badge.svg)](https://github.com/clercjs/clerc/actions/workflows/ci.yml)
[![Downloads/week](https://img.shields.io/npm/dw/clerc.svg)](https://npmjs.org/package/clerc)
[![License](https://img.shields.io/npm/l/clerc.svg)](https://github.com/clercjs/clerc/blob/main/package.json)
- [✨ Features](#-features)
- [😊 The simplest CLI example](#-the-simplest-cli-example)
- [📖 Documentation](#-documentation)
- [🦄 Examples](#-examples)
- [🤔 More...](#-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`:
```ts
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](./examples/greeting) - The example from above
- [Bumpp](./examples/bumpp) - Reimplementation of [`Bumpp`](https://github.com/antfu/bumpp)'s CLI# 🤔 More...
## Why using Clerc?
Clerc uses [`type-flag`](https://github.com/privatenumber/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`](https://github.com/so1ve/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`](https://github.com/privatenumber/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](./LICENSE). Made with ❤️ by [Ray](https://github.com/so1ve)