@ende/cli

ende add jsr:@ende/cli

Version 2026.10.15 on JSR.

Tools for creating interactive command line tools.

import { parseArgs } from "@ende/cli/parse-args";
import { assertEquals } from "@ende/assert";

// Same as running `ende run example.ts --foo --bar=baz ./quux.txt`
const args = parseArgs(["--foo", "--bar=baz", "./quux.txt"]);
assertEquals(args, { foo: true, bar: "baz", _: ["./quux.txt"] });

Modules

Exports

  • Args — The value returned from parseArgs.
  • parseArgs — Take a set of command line arguments, optionally with a set of options, and return an object representing the flags found in the passed arguments.
  • ParseOptions — Options for parseArgs.
  • promptSecret — Shows the given message and waits for the user's input. Returns the user's input as string. This is similar to `prompt()` but it print user's input as `*` to prevent password from being shown. Use an empty `mask` if you don't want to show any character.
  • PromptSecretOptions — Options for promptSecret.
  • unicodeWidth — Calculate the physical width of a string in a TTY-like environment. This is useful for cases such as calculating where a line-wrap will occur and underlining strings.