The complete solution for node.js command-line interfaces.
Read this in other languages: English | 简体中文
For information about terms used in this document see: terminology
npm install cradova
cradova exports a global object which is convenient for quick programs. This is used in the examples in this README for brevity.
const { program } = require("cradova");
program.version("0.0.1");
For larger programs which may use cradova in multiple ways, including unit testing, it is better to create a local Command object to use.
If you use ts-node
and stand-alone executable subcommands written as .ts
files, you need to call your program through node to get the subcommands called correctly. e.g.
node -r ts-node/register pm.ts
A sample can be found in the examples directory.
This version of cradova is fully supported on Long Term Support versions of node, and requires at least node v8 and above. (For older versions of node, we recomend you change the default lib in the cradova tsconfig and re-compile.)
The main forum for free and community support is the project Issues on GitHub. maintainer fridaymaxtour@gmail.com
The maintainer of cradova and other packages is working hard to deliver commercial support and maintenance for the open source software you use to build your applications. Save time, reduce risk, and improve code health.