0.1.11 • Published 4 years ago

commanderdoc v0.1.11

Weekly downloads
8
License
MIT
Repository
github
Last release
4 years ago

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:

NameTypeDefaultDescription
commandCommandType-inspected command to inspect (result of getCommand(command))
startLevelnumber1header level to start with
parentsstring[][]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:

NameTypeDefaultDescription
commanderobject-Top level commander object (usually from export commander or module.exports.commander = commander)
cliNamestring-Name of the executable (for usage documentation)
startLevelnumber1Level 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:

NameTypeDescription
commandobjectCommander command object to inspect

Returns: CommandType


getCommands

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

Defined in index.ts:53

Recursively inspect a list of commands

Parameters:

NameTypeDescription
commandsobject[]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:

NameTypeDescription
optionobjectOption 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:

NameTypeDescription
optionsany[]Options for a command

Returns: object[]


optionToMd

optionToMd(option: OptionType): string

Defined in index.ts:87

Generate markdown for a single commander option

Parameters:

NameTypeDescription
optionOptionTypeOption 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:

NameTypeDescription
levelnumberlevel of the markdown header padding

Returns: string

0.1.10

4 years ago

0.1.11

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.5

4 years ago

0.1.0

4 years ago