Skip to content

Files

Latest commit

Feb 25, 2025
0a0b8bb · Feb 25, 2025

History

History

ucmd

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Feb 25, 2025
Feb 15, 2024
Jan 25, 2023
Feb 15, 2024
Jan 25, 2023

README.md

µCMD API Docs

minimal and strictly typed argument parsing for node.js 19+

Installation

$ npm i ucmd
# or
$ yarn add ucmd
# or
$ pnpm add ucmd

Usage

TypeScript
import { ucmd, Command } from "ucmd";

const buildCommand = {
  name: "build",
  run: (ctx) => console.log(ctx.args, ctx.positionals),
  args: {
    config: {
      type: "string",
      short: "c",
    },
  },
} satisfies Command;

ucmd("scripts")
  .withCommand({
    name: "test",
    run: (ctx) => console.log(ctx.args, ctx.positionals),
  })
  .withCommand(buildCommand)
  .run();