Skip to content

Repository files navigation

clipse

CLI parsing so easy — a tiny, type-safe CLI builder for Bun & Node.

Declare your options and arguments, and clipse infers their types into a fully typed action callback. Subcommands, default commands, global options, auto-generated help, and bash completion are all included.

📖 Documentation: https://gouz.github.io/clipse/

Install

bun add clipse   # or: npm install clipse

Quick start

import { Clipse } from "clipse";

new Clipse("greet", "say hello", "1.0.0")
  .addOptions({
    loud: { short: "l", type: "boolean", description: "shout it" },
  })
  .addArguments([{ name: "who", description: "who to greet" }])
  .action((args, opts) => {
    const msg = `Hello, ${args.who ?? "world"}!`;
    console.log(opts.loud ? msg.toUpperCase() : msg);
  })
  .ready();
$ greet Alice --loud
HELLO, ALICE!

opts.loud is a boolean, args.who is a string — inferred from what you declared. Unknown keys and wrong value types fail to compile.

Documentation

The docs follow the Diátaxis framework:

  • Tutorial — build your first CLI step by step.
  • How-to guides — options, arguments, subcommands, completion, and more.
  • Reference — the full Clipse API and types.
  • Explanation — design philosophy and how type inference works.

Contributing to the docs

bun install
bun run docs:dev     # local preview at http://localhost:5173
bun run docs:build   # production build

License

MIT © gouz

About

A cli parser

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages