Terminology

Sparkplug breaks its command management system into multiple parts. Definitions of each of the parts and how they are related are below.

Host

A host is the main part of the system. It contains units and can call the commands contained within them given a string that the user has entered.

Unit

A unit is a provider of commands. It is an object in which all of the callable attributes (that don’t begin with an underscore) are assumed to be accessible by the host.

Command

A command is a function that belongs to a unit and executes a certain task. Its parameters (other than self) should be annotated in order to tell the host executing it how to fulfill its parameters.

Strategy

A strategy is what a host uses to resolve the parameters of a command. It is a function that should take a string (which contains the arguments passed to the command) and return a tuple of the object interpreted from it and a string containing the parameters that were not used to interpret the object. These remaining arguments are passed into the next strategy which parses the next argument, if it exists.

A local strategy is a strategy that only applies to a certain unit.