Skip to content

@briklab/lib/cli-john

cli-john is a Node.js command-line framework with command routing, option parsing, and formatted logging helpers.

Requirements

  • Node.js runtime
  • @briklab/lib installed

Quick Start (ESM)

js
import { CLI } from "@briklab/lib/cli-john";
import * as process from "node:process";

const cli = new CLI(process);

cli.command("echo").on("command", ({ commandArgs }) => {
  console.log(commandArgs.join(" "));
});

cli.run();

Quick Start (CJS)

js
const { CLI } = require("@briklab/lib/cli-john");
const process = require("node:process");

const cli = new CLI(process);
cli.command("echo").on("command", ({ commandArgs }) => console.log(commandArgs.join(" ")));
cli.run();

Pages