Clingy

Clingy

Core Clingy class, entry point for creation of a new instance.

Constructor

new Clingy(commands, options)

Source:

Creates a new Clingy instance.

Parameters:
Name Type Description
commands

Map of commands to create the instance with.

options

Option object.

Methods

getCommand(key)

Source:

Gets a command from this instance.

Parameters:
Name Type Description
key

Key of the command.

getPath(path)

Source:

Resolves a pathUsed to a command.

Parameters:
Name Type Description
path

Path to look up.

Returns:

Lookup result, either ILookupSuccess or ILookupErrorNotFound.

hasCommand(key)

Source:

Checks if a command on this instance exists for this key.

Parameters:
Name Type Description
key

Key of the command.

hasPath(path)

Source:

Checks if a pathUsed resolves to a command.

Parameters:
Name Type Description
path

Path to look up.

Returns:

If the pathUsed resolves to a command.

parse(input)

Source:

Parses a string into a command and arguments.

Parameters:
Name Type Description
input

String to parse.

Returns:

Lookup result, either ILookupSuccess, ILookupErrorNotFound or ILookupErrorMissingArgs.

setCommand(key, command)

Source:

Sets a command on this instance.

Parameters:
Name Type Description
key

Key of the command.

command

The command.