Program Builder

A TypeScript library for building command-line interfaces

Type Safe

Define your arguments and then execute your main function with a strongly-typed args object that takes into account the types of arguments and their optionality.

args: {
filename: string;
count: number | null;
force: boolean;
quiet: boolean;
}

Automatic Help Text Generation

$ ts-node main.ts -h
Usage: main.ts [options] <filename> [extraFilename]
My awesome program.
Options:
--count, -c [count]
--requiredCount [requiredCount]

Feature Packed

Enjoy the features of a modern CLI-parsing library.

  • Required and optional positional arguments.
  • Boolean flags, including inverted flags like --no-verbose.
  • Valued flags, with type conversions to integers, floats, etc.
  • Default values.
  • Validation that required arguments are provided.
  • Help-text generation.
  • Subcommands.