# generate-cli-api-help

> given a TypeScript interface it will generate: * a function printing usage CLI Usage information * a markdown section detailing CLI Usage information * a markdown section detailing JavaScript API Usage information

Latest version **0.0.7** (published 2018-12-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install generate-cli-api-help
pnpm add generate-cli-api-help
yarn add generate-cli-api-help
bun add generate-cli-api-help
```

Provides the command `generate-cli-api-help`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2018-12-24 |
| First published | 2018-08-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 18.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 24 |
| Author | Sebastian Gurin |
| Maintainers | cancerberosgx |
| Keywords | documentation, javascript, typescript, CLI |

## Links

- npm: https://www.npmjs.com/package/generate-cli-api-help
- Repository: https://github.com/cancerberoSgx/node-lucene/tree/master/generate-cli-api-help
- npm.io page: https://npm.io/package/generate-cli-api-help

## Dependencies (2)

- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [ts-simple-ast](https://npm.io/package/ts-simple-ast.md) ^12.5.4

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 0.0.7 (latest) — 2018-12-24
- 0.0.6 — 2018-12-24
- 0.0.5 — 2018-12-24
- 0.0.4 — 2018-12-24
- 0.0.3 — 2018-12-24
- 0.0.2 — 2018-08-24

## README

# What's this?

Given a TypeScript interface be able to:

 * print given interface describing each property using TS typing info and jsdoc
 * Supports different output formats (markdown, JavaScript string, etc)

 <!-- * a markdown section detailing CLI Usage information
 * a markdown section detailing JavaScript API Usage information  -->

Returned text can be used in different parts of user's program, for example, README.md, showHelp() function of CLI, etc. Ideal for small tools that defines its "Options" object in a TS interface. 

Ideally, projects should use this tool at build time to build the help strings assets. Using the tool dynamically is possible but but take into account that : this project depends on typescript which is big. If user's app aim is to be small (and perhaps support browser) then using the API directly is a bad idea. 

# Usage Node.js API

```sh
npm install --save generate-cli-api-help
```

```ts
import {printHelp} from 'generate-cli-api-help'

const fileWithInterface = 'src/types.ts' // the .ts file containing the Config / Options interface from which to extract the help usage information
const interfaceName = 'MyAwesomeAppOptions' // The name of the interface with usage / config options
const config = {fileWithInterface, interfaceName}
const addMeToYourCode = printHelp(config)
```


# Usage CLI

```sh
npm install -g generate-cli-api-help

generate-cli-api-help --input src/types.ts --interfaceName Options
```



# TODO

 * support inheritance
 
 * move to its own repo 

 * object validation : given a config object and interface validate the input. Validate Optionals. user programs could use us like: 
 
  const args = .... // minimist/yargs like object. 
  
  validate({input: file.ts, interfaceName: 'Config', validate: args})

Validate optionals but also types and non existent properties ?

---
_Source: https://npm.io/package/generate-cli-api-help · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
