Reference

Command line based invoke framework.

prefix(values, content)

Discover start and separate from content.

Parameters:
  • values (list[str]) – Will scan through up to the one content starts with.
  • content (str) – The value to scan, will separate from the start if found.
Raises:

ValueError if no start matches.

>>> prefix(('-', '.', '!'), './echo')
>>> ('.', '/echo')
class State(lower='.', upper=' ')

Bases: dict

Means of adding, parsing and invoking commands.

Parameters:
  • lower (str) – Separates commands from arguments.
  • upper (str) – Splits arguments away from each other.
sub(name, **space)

Decorator for adding commands.

Parameters:name (str) – The name of the command.
asset(*names)

Get (name, invoke) pair from names.

Raises:KeyError with the name not found.
trail(*names)

Uses asset() to get invoke.

parse(content)

Get (names, argument) from content .

analyse(content, starts=('', ), apply=None)

Split the content into its components and derive the invoke.

Parameters:
  • starts (tuple[str]) – Will be checked against the beginning of the content.
  • apply (func) – Used on names for any further parsing.