https://github.com/hipstersmoothie/command-line-docs
https://github.com/hipstersmoothie/command-line-docs
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hipstersmoothie/command-line-docs
- Owner: hipstersmoothie
- License: mit
- Created: 2019-07-03T20:34:00.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-11-01T00:48:52.000Z (6 months ago)
- Last Synced: 2025-01-12T12:30:34.927Z (4 months ago)
- Language: TypeScript
- Size: 262 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
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 });
```