Skip to main content
The Deno 2 Release Candidate is here
Learn more

ecli

ecli (pronounced easily) makes it easy to build and document a command-line interface (CLI) in TypeScript for Deno.

License Deno doc Deno module Github tag Build Code coverage

Motivation

If you know how to use it, a CLI is an efficient and portable way of running code. Deno already makes it easy to develop and use a CLI written in TypeScript. While developing the CLI is easy, formatting help texts and user feedback for display in a terminal is tedious and can become repetitive. ecli is a customizable tool that accelerates the process of turning a TypeScript module into a well documented CLI.

Documentation

ecli is still in a very early phase and may be subject to significant changes, refactoring, and deprecation. The code is currently divided into multiple thematic parts:

  • log.ts defines functions for printing to the console or streams.
  • text.ts defines lower level components for formatting text.
  • options.ts defines components for documenting arguments and flags.
  • permissions.ts defines components for documenting Deno permissions.
  • usage.ts defines components for documenting installation and usage with Deno.
  • history.ts defines components for outputting temporal data and events.
  • help.ts defines components for outputting a help page.
  • mod.ts exports the above modules.

There are no unit tests yet, but components can be visually tested by running the corresponding <name>_demo.ts module. For example, the mod.ts module may be tested by running deno run mod_demo.ts and examining the output.