climonad.js
is a feature-rich framework for building structured and maintainable command-line tools.
Warning
This library is in early development, and APIs may change.
- 🌳 Hierarchical Commands: Build nested commands and subcommands effortlessly.
- 🛠️ Powerful Flag Parsing: Manage flags with defaults, requirements, and validation.
- 📋 Custom Usage Messages: Provide clear and tailored help text for every command.
- 🗂️ Scoped Management: Separate global and local flags for better organization.
Install via npm:
npm install climonad
Here’s a simple CLI configuration:
const app = cli({
name: "cli",
description: "A simple CLI",
flags: [str({ name: "config", alias: "c", description: "Config file", required: true })],
commands: [
cmd({
name: "init",
description: "Initialize a new project",
flags: [str({ name: "name", description: "Project name", required: true })],
action: async ({ flags }) => {
console.log("Initializing project:", flags.get("name"))
console.log("Using config file:", flags.get("config"))
},
}),
],
})
app.run(process.argv)
Run your CLI:
node cli init --name my-project -c config.json
Output:
Initializing project: my-project
Using config file: config.json
This project is licensed under the MIT License.