Comparing version 6.3.1 to 6.3.2
@@ -557,3 +557,3 @@ 'use strict'; | ||
command(rawName, description, config) { | ||
const command = new Command_1$$1.default(rawName, description, config, this); | ||
const command = new Command_1$$1.default(rawName, description || '', config, this); | ||
command.globalCommand = this.globalCommand; | ||
@@ -560,0 +560,0 @@ this.commands.push(command); |
{ | ||
"name": "cac", | ||
"version": "6.3.1", | ||
"version": "6.3.2", | ||
"description": "Simple yet powerful framework for building command-line apps.", | ||
@@ -20,3 +20,4 @@ "repository": { | ||
"toc": "markdown-toc -i README.md", | ||
"prepublishOnly": "npm run build" | ||
"prepublishOnly": "npm run build", | ||
"docs:api": "typedoc --out api-doc --readme none --exclude \"**/__test__/**\" --theme minimal" | ||
}, | ||
@@ -42,2 +43,3 @@ "author": "egoist <0x142857@gmail.com>", | ||
"ts-node": "^7.0.1", | ||
"typedoc": "^0.13.0", | ||
"typescript": "^3.1.6" | ||
@@ -44,0 +46,0 @@ }, |
@@ -9,2 +9,9 @@ <img width="945" alt="2017-07-26 9 27 05" src="https://user-images.githubusercontent.com/8784712/28623641-373450f4-7249-11e7-854d-1b076dab274d.png"> | ||
## Features | ||
- **Super light-weight**: No dependency, just a single file. | ||
- **Easy to learn**. There're only 4 APIs you need to learn for building simple CLIs: `cli.option` `cli.version` `cli.help` `cli.parse`. | ||
- **Yet so powerful**. Enable features like default command, git-like subcommands, validation for required arguments and options, variadic arguments, dot-nested options, automated help message generation and so on. | ||
- **Developer friendly**. Written in TypeScript. | ||
## Table of Contents | ||
@@ -42,2 +49,3 @@ | ||
- [How is the name written and pronounced?](#how-is-the-name-written-and-pronounced) | ||
- [Why not use Commander.js?](#why-not-use-commanderjs) | ||
- [Contributing](#contributing) | ||
@@ -108,3 +116,3 @@ - [Author](#author) | ||
cli | ||
.command('rm <dir>') | ||
.command('rm <dir>', 'Remove a dir') | ||
.option('-r, --recursive', 'Remove recursively') | ||
@@ -233,3 +241,3 @@ .action((dir, options) => { | ||
**๐ Check out [the generated docs](https://cac-api-doc.egoist.sh/modules/_index_.html) from source code if you want a more in-depth API references.** | ||
**๐ Check out [the generated docs](https://cac-api-doc.egoist.sh/classes/_cac_.cac.html) from source code if you want a more in-depth API references.** | ||
@@ -399,2 +407,10 @@ Below is a brief overview. | ||
### Why not use Commander.js? | ||
CAC is very similar to Commander.js, while the latter does not support dot nested options, i.e. something like `--env.API_SECRET foo`. Besides, you can't use unknown options in Commander.js either. | ||
_And maybe more..._ | ||
Basically I made CAC to fulfill my own needs for building CLI apps like [Poi](https://poi.js.org), [SAO](https://saojs.org) and all my CLI apps. It's small, simple but powerful :P | ||
## Contributing | ||
@@ -401,0 +417,0 @@ |
@@ -47,3 +47,3 @@ /// <reference types="node" /> | ||
*/ | ||
command(rawName: string, description: string, config?: CommandConfig): Command; | ||
command(rawName: string, description?: string, config?: CommandConfig): Command; | ||
/** | ||
@@ -50,0 +50,0 @@ * Add a global CLI option. |
43885
425
18