npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

commanderdoc

v0.1.11

Published

<a name="readmemd"></a>

Downloads

8

Readme

commanderdoc - v0.1.11Globals

commanderdoc - v0.1.11

Usage

commanderdoc [options] [command]

Commands

markdown <sourcefile>

Usage

commanderdoc markdown [options] <sourcefile>

Options

  • -e --exported <commanderObject> Name of the exported commander object to inspect (default: commander)
  • -o --out-file <outfile> File to store markdown output (defaults to stdout)
  • -n --cli-name <name> Name of the executable

json <sourcefile>

Extract inspected commander as JSON

Usage

commanderdoc json [options] <sourcefile>

Options

  • -e --exported <commanderObject> Name of the exported commander object to inspect (default: commander)
  • -o --out-file <outfile> File to store markdown output (defaults to stdout)

commanderdoc - v0.1.11Globals

commanderdoc - v0.1.11

Index

Type aliases

Functions

Type aliases

CommandType

Ƭ CommandType: object

Defined in index.ts:42

Type declaration:

  • args? : object[]

  • commands? : CommandType[]

  • description? : undefined | string

  • name: string

  • options? : OptionType[]


OptionType

Ƭ OptionType: ReturnType‹typeof getOption›

Defined in index.ts:41

Functions

commandToMd

commandToMd(command: CommandType, startLevel: number, parents: string[]): string

Defined in index.ts:104

Convert an inspected command to a markdown string

Parameters:

Name | Type | Default | Description | ------ | ------ | ------ | ------ | command | CommandType | - | inspected command to inspect (result of getCommand(command)) | startLevel | number | 1 | header level to start with | parents | string[] | [] | list of parent commands and cli name to document usage |

Returns: string


commanderToMd

commanderToMd(commander: object, cliName: string, startLevel: number): string

Defined in index.ts:173

Document a top-level cli - recommended use case

Parameters:

Name | Type | Default | Description | ------ | ------ | ------ | ------ | commander | object | - | Top level commander object (usually from export commander or module.exports.commander = commander) | cliName | string | - | Name of the executable (for usage documentation) | startLevel | number | 1 | Level to start the markdown headers (e.g. use 2 or greater to fit it into sub-documentation) |

Returns: string


getCommand

getCommand(command: object): CommandType

Defined in index.ts:60

Generate a map of properties of a command object

Parameters:

Name | Type | Description | ------ | ------ | ------ | command | object | Commander command object to inspect |

Returns: CommandType


getCommands

getCommands(commands: object[]): CommandType[]

Defined in index.ts:53

Recursively inspect a list of commands

Parameters:

Name | Type | Description | ------ | ------ | ------ | commands | object[] | List of commands to inspect (usually from command.commands) |

Returns: CommandType[]


getOption

getOption(option: object): object

Defined in index.ts:13

Get filtered list of attributes for a single options

Parameters:

Name | Type | Description | ------ | ------ | ------ | option | object | Option for a commands |

Returns: object

  • args: any

  • defaultValue: any

  • description: any

  • flags: any

  • long: any

  • mandatory: any

  • negate: any

  • optional: any

  • required: any

  • short: any

  • variadic: any


getOptions

getOptions(options: any[]): object[]

Defined in index.ts:7

Get filtered map of attributes for a list of options

Parameters:

Name | Type | Description | ------ | ------ | ------ | options | any[] | Options for a command |

Returns: object[]


optionToMd

optionToMd(option: OptionType): string

Defined in index.ts:87

Generate markdown for a single commander option

Parameters:

Name | Type | Description | ------ | ------ | ------ | option | OptionType | Option to generate markdown for |

Returns: string


padLevel

padLevel(level: number): string

Defined in index.ts:81

Generate a markdown header prefix at the indicated level

internal

Parameters:

Name | Type | Description | ------ | ------ | ------ | level | number | level of the markdown header padding |

Returns: string