package tkt

Interfaces

Name Summary

ICli

A command-line interface created by the cli function.

ILogger

A logger instance created by the logger function or the ILogger#child method.

Functions

cli(globalOptions)

Creates a command-line interface.

Parameters
Name Type Description

globalOptions

GlobalOptions

The global options which apply to all commands. See yargs API for details.

Returns

ICli<~yargs.Argv<~yargs.Omit<{}, keyof GlobalOptions> & ~yargs.InferredOptionTypes<GlobalOptions>>>

An ICli instance.

Signature
export declare function cli<GlobalOptions extends {}>(globalOptions?: GlobalOptions): ICli<yargs.Argv<yargs.Omit<{}, keyof GlobalOptions> & yargs.InferredOptionTypes<GlobalOptions>>>;

invariant(value, message, extra)

Asserts state which your program assumes to be true. If it is false, an error is thrown.

Parameters
Name Type Description

value

any

The value to assert.

message

string

The message format string to display on error.

extra

any[]

Optional values used to populate the message format string.

Returns

asserts tkt!\~value

Signature
export declare function invariant(value: any, message: string, ...extra: any[]): asserts value;

logger(name)

Create an ILogger instance with a given name.

Parameters
Name Type Description

name

string

The name to use for logging.

Returns

ILogger

Signature
export declare function logger(name: string): ILogger;

logger.forceJSON()

Force the logger to write JSON output.

Signature
function forceJSON(): void;

logger.forcePretty()

Force the logger to write pretty-printed output rather than JSON.

Signature
function forcePretty(): void;