Home Reference Source Test Repository
import Formatter from 'console-commando/src/formatter.js'
public class | source

Formatter

Helper class for formatting help output.

Constructor Summary

Public Constructor
public

Creates a new formatter with the given config.

Method Summary

Public Methods
public

debug()

Prints out debugging information.

public

get(key: string): *

Gets a property of the Formatter instance.

public

padArgument(): function(text: string, required: boolean): string

Returns a padding function for arguments.

public

Returns a padding function for commands.

public

Returns a padding function for descriptions.

public

Returns a padding function for long options.

public

Returns a padding function for short options

public

Returns a padding function for sub commands.

public

Returns a padding function for command options.

Public Constructors

public constructor(config: object): Formatter source

Creates a new formatter with the given config.

Params:

NameTypeAttributeDescription
config object

A formatter configuration.

Return:

Formatter

The new Formatter.

Public Methods

public debug() source

Prints out debugging information.

public get(key: string): * source

Gets a property of the Formatter instance.

Params:

NameTypeAttributeDescription
key string

The name of the property to get.

Return:

*

The value of the property.

public padArgument(): function(text: string, required: boolean): string source

Returns a padding function for arguments.

Return:

function(text: string, required: boolean): string

The generated function.

public padCommand(): function(text: string): string source

Returns a padding function for commands.

Return:

function(text: string): string

The generated function.

public padDescription(): function(text: string): string source

Returns a padding function for descriptions.

Return:

function(text: string): string

The generated function.

public padOption(): function(text: string): string source

Returns a padding function for long options.

Return:

function(text: string): string

The generated function.

public padShortOption(): function(text: string): string source

Returns a padding function for short options

Return:

function(text: string): string

The generated function.

public padSubCommand(): function(text: string): string source

Returns a padding function for sub commands.

Return:

function(text: string): string

The generated function.

public padSubCommandOption(): function(text: string): string source

Returns a padding function for command options.

Return:

function(text: string): string

The generated function.