An open API service indexing awesome lists of open source software.

https://github.com/ahmadawais/cli-meow-help

🐈 Generate automagically formatted help text for `meow` CLI app helper.
https://github.com/ahmadawais/cli-meow-help

cli command-line help javascript kitten meow meow-help nodejs

Last synced: 8 months ago
JSON representation

🐈 Generate automagically formatted help text for `meow` CLI app helper.

Awesome Lists containing this project

README

          

[![cli-meow-help running in a terminal](./.github/cli-meow-help.png)](./../../)

# cli-meow-help

[![DOWNLOADS](https://img.shields.io/npm/dt/cli-meow-help?label=DOWNLOADS%20%20āÆ&colorA=6A788D&colorB=6A788D&style=flat)](https://www.npmjs.com/package/cli-meow-help) [![Node.js CLI](https://img.shields.io/badge/-NodeCLI.com-gray.svg?colorB=6A788D&style=flat)](https://NodeCLI.com/?utm_source=FOSS) [![Learn VSCode](https://img.shields.io/badge/-VSCODE.pro-gray.svg?colorB=6A788D&style=flat)](https://VSCode.pro/?utm_source=FOSS) [![Sponsor](https://img.shields.io/badge/-Sponsor-gray.svg?colorB=6A788D&style=flat)](https://github.com/ahmadawais/sponsor?utm_source=FOSS)
[![Follow @MrAhmadAwais on Twitter](https://img.shields.io/badge/FOLLOW%20@MRAHMADAWAIS%20%E2%86%92-gray.svg?colorA=6A788D&colorB=6A788D&style=flat)](https://twitter.com/mrahmadawais/)

> Generate automatically formatted help text for [`meow`](https://github.com/sindresorhus/meow) CLI helper


[![šŸ“Ÿ](https://raw.githubusercontent.com/ahmadawais/stuff/master/images/git/install.png)](./../../)

## Install

```sh
npm install meow cli-meow-help
```


[![āš™ļø](https://raw.githubusercontent.com/ahmadawais/stuff/master/images/git/usage.png)](./../../)

## Usage

```js
const meow = require('meow');
const meowHelp = require('cli-meow-help');

const commands = {
new: {desc: `Creates a new user account`},
duplicate: {desc: `Duplicates a user account`}
};

const flags = {
random: {
desc: `Prints random data`,
type: 'boolean',
default: true
}
};

const helpText = meowHelp({
name: `cli-command`,
flags,
commands
});

meow(helpText, {flags});

// Now run `cli-command --help` to view the
// following auto formatted & generated help info.
```

[![cli-meow-help running in a terminal](./.github/cli-meow-help.png)](./../../)


[![šŸ“ƒ](https://raw.githubusercontent.com/ahmadawais/stuff/master/images/git/options.png)](./../../)

## API

### meowHelp(options)

#### āÆ options

Type: `object`

Default: ↓

```js
{
name = `(CLI name undefined)`,
desc,
commands = {},
flags = {},
examples = [],
defaults = true,
header,
footer
}
```

You can specify the options below.

#### āÆ name

Type: `string`

Default: `(CLI name undefined)`

The `bin` command name of the cli that's used to run the CLI. Examples: `corona` for the [corona-cli](https://github.com/AhmadAwais/corona-cli) that's installed globally or `npx corona-cli` for if `npx` is the recommended usage.

#### āÆ desc

Type: `string`

Default: `undefined` (optional)

Optionally define a description text for the help message.

#### āÆ commands

Type: `string`

Default: `{}` (optional)

Optionally, define a JavaScript object containing info on the CLI commands (i.e. `meow` inputs). Each command has a `desc` property to define the help text.

#### āÆ flags

Type: `string`

Default: `{}`

Define CLI options (i.e. `meow` flags) just like you do with `meow` which is the `flags` JavaScript object containing each flag with an extra `desc` property to define the help text.

##### > examples

Type: `Array`

Default: `[]`

List optional examples of how to use the CLI.

> Check the [test](./test.js) file for more context. Format example:

```js
const examples = [

{
command: `new`,
flags: [`random`]
}
];
```

#### āÆ defaults

Type: `string`

Default: `true` (optional)

Prints out the default values of flags. Set to `false` to disable.

#### āÆ header

Type: `string`

Default: `undefined` (optional)

Optionally, add additional header information.

#### āÆ footer

Type: `string`

Default: `undefined` (optional)

Optionally, add additional footer information.


[![šŸ“](https://raw.githubusercontent.com/ahmadawais/stuff/master/images/git/log.png)](changelog.md)

## Changelog

[āÆ Read the changelog here →](changelog.md)


**KEY**: `šŸ“¦ NEW`, `šŸ‘Œ IMPROVE`, `šŸ› FIX`, `šŸ“– DOC`, `šŸš€ RELEASE`, and `šŸ¤– TEST`

> _I use [Emoji-log](https://github.com/ahmadawais/Emoji-Log), you should try it and simplify your git commits._


[![šŸ“ƒ](https://raw.githubusercontent.com/ahmadawais/stuff/master/images/git/license.png)](./../../)

## License & Conduct

- MIT Ā© [Ahmad Awais](https://twitter.com/MrAhmadAwais/)
- Thanks to Maarten Brakkee for initial implementation
- [Code of Conduct](code-of-conduct.md)


[![šŸ™Œ](https://raw.githubusercontent.com/ahmadawais/stuff/master/images/git/connect.png)](./../../)

## Connect


GitHub @AhmadAwaisĀ (follow) To stay up to date on free & open-source software


Twitter @MrAhmadAwaisĀ (follow) To get #OneDevMinute daily hot tips & trolls


YouTube AhmadAwaisĀ (subscribe) To tech talks & #OneDevMinute videos


Blog: AhmadAwais.comĀ (read) In-depth & long form technical articles


LinkedIn @MrAhmadAwaisĀ (connect) On the LinkedIn profile y'all



[![šŸ‘Œ](https://raw.githubusercontent.com/ahmadawais/stuff/master/images/git/sponsor.png)](https://github.com/AhmadAwais/sponsor)

## Sponsor

Me ([Ahmad Awais](https://twitter.com/mrahmadawais/)) and my incredible wife ([Maedah Batool](https://twitter.com/MaedahBatool/)) are two engineers who fell in love with open source and then with each other. You can read more [about me here](https://ahmadawais.com/about). If you or your company use any of my projects or like what I’m doing then consider backing me. I'm in this for the long run. An open-source developer advocate.

[![Ahmad on Twitter](https://img.shields.io/twitter/follow/mrahmadawais.svg?style=social&label=Follow%20@MrAhmadAwais)](https://twitter.com/mrahmadawais/)

### [NodeCLI.com][n] — Learn to build Node.js CLI Automation

> This repository is part of the [NodeCLI.com][n] course.

After building hundreds of developer automation tools used by millions of developers, I am sharing exactly how you can do it yourself with minimum effective effort. Learn to build Node.js & JavaScript based CLI (Command Line Interface) apps. Automate the grunt work, do more in less time, impress your manager, and help the community.
→ I'm sharing it all in this online video course. [Node CLI Automation
without wasting a 1,000 hours][n] →

[![Node CLI Course](https://raw.githubusercontent.com/ahmadawais/stuff/master/nodecli/featured.jpg)][n]

[![Node CLI](https://img.shields.io/badge/-NodeCLI.com%20%E2%86%92-gray.svg?colorB=488640&style=flat)][n]

[n]: https://NodeCLI.com?utm_source=github&utm_medium=referral&utm_campaign=ahmadawais/cli-meow-help

[![Awais on Twitter](https://raw.githubusercontent.com/ahmadawais/stuff/master/sponsor/sponsor.jpg)](https://github.com/AhmadAwais/sponsor)