# command-line-docs

> Generate markdown documentation based on your [command-line-application](https://github.com/hipstersmoothie/command-line-application) command definitions

Latest version **0.0.6** (published 2019-10-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install command-line-docs
pnpm add command-line-docs
yarn add command-line-docs
bun add command-line-docs
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2019-10-17 |
| First published | 2019-07-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 33.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Andrew Lisowski |
| Maintainers | alisowski |

## Links

- npm: https://www.npmjs.com/package/command-line-docs
- Repository: https://github.com/hipstersmoothie/command-line-docs
- Homepage: https://github.com/hipstersmoothie/command-line-docs#readme
- Issues: https://github.com/hipstersmoothie/command-line-docs/issues
- npm.io page: https://npm.io/package/command-line-docs

## Dependencies (2)

- [dedent](https://npm.io/package/dedent.md) ^0.7.0
- [command-line-application](https://npm.io/package/command-line-application.md) ^0.8.0

## Recent versions

- 0.0.6 (latest) — 2019-10-17
- 0.0.5 — 2019-09-03
- 0.0.4 — 2019-09-03
- 0.0.3 — 2019-07-12
- 0.0.2 — 2019-07-04
- 0.0.1 — 2019-07-03

## README

# command-line-docs

Generate markdown documentation based on your [command-line-application](https://github.com/hipstersmoothie/command-line-application) command definitions

## Installation

```sh
npm i -D command-line-docs
# or
yarn add -D command-line-docs
```

## Usage

This package support both the `Command` and `MultiCommand` from [command-line-application](https://github.com/hipstersmoothie/command-line-application).

```js
import { Command } from 'command-line-application';
import docs from 'command-line-docs';

const echo: Command = {
  name: 'echo',
  description: 'Print a string to the terminal',
  options: [
    {
      name: 'value',
      type: String,
      defaultOption: true,
      description: 'The value to print',
    },
  ],
};

console.log(docs(echo));
```

This will output:

```md
# `echo`

Print a string to the terminal

## Options

| Flag        | Type   | Description        |
| ----------- | ------ | ------------------ |
| \`--value\` | String | The value to print |
```

## Options

### Depth

Control the header depth.

```js
// Now the docs will start with an h2 instead of an h1
docs(echo, { depth: 1 });
```

### Including global options with each sub-command

You might want to include the global options in each sub-command's options table. To do this use the `includeGlobalOptionsForSubCommands` option.

```js
docs(echo, { includeGlobalOptionsForSubCommands: true });
```

---
_Source: https://npm.io/package/command-line-docs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
