sacli
TypeScript icon, indicating that this package has built-in type declarations

4.0.4 • Public • Published

sacli

Elegant and modern CLI builder for Node.js applications.

Features

  • Multiple commands at any depth.
  • Automatic nicely formatted command help.
  • Type safe across commands.

Get it now:

npm i sacli

Example

const git = Command.new()
  .optional("dir", String)
  .required("id", Number)
  .repeated("flags", String);

git
  .subcommand("status")
  .boolean("verbose", {description: "Show full details"})
  .repeated("folders", String, {alias: "F"})
  .repeated("files", String, {default: true})
  .action((args) => {
    args.dir === undefined;
    args.id === 78;
    args.flags.length === 0;
    args.verbose === false;
    arrayEquals(args.folders, ["a/", "b/"]);
    arrayEquals(args.files, ["a", "b", "c"]);
  });

git.eval(["--id", "78", "status", "-F", "a/", "b/", "--", "a", "b", "c"]);

Dependencies (0)

    Dev Dependencies (7)

    Package Sidebar

    Install

    npm i sacli

    Weekly Downloads

    26

    Version

    4.0.4

    License

    MIT

    Unpacked Size

    13.8 kB

    Total Files

    5

    Last publish

    Collaborators

    • wilsonzlin