titus.inspector.defs.SimpleCommand

class titus.inspector.defs.SimpleCommand(name, action, minargs=None, maxargs=None, completer=None, help=None, syntax=None)[source]

Bases: titus.inspector.defs.Command

A pfainspector command whose action can be expressed as a Python lambda expression.

__init__(name, action, minargs=None, maxargs=None, completer=None, help=None, syntax=None)

Create a SimpleCommand.

Parameters:
  • name (string) – name of the command
  • action (callable) – action to perform, usually supplied as a Python lambda expression.
  • minargs (non-negative integer or None) – if provided, a minimum legal number of arguments for the command
  • maxargs (non-negative integer or None) – if provided, a maximum legal number of arguments for the command
  • completer (callable) – function to call to complete the arguments of the command
  • help (string) – message to the user describing the purpose of this command
  • syntax (string) – message to the user specifying the syntax of this command
action(args)

Perform the action associated with this command.

Parameters:args (list of titus.inspector.parser.Ast) – arguments passed to the command
Return type:None
Returns:nothing; results must be printed to the screen
complete(established, active)

Handle tab-complete for this command’s arguments.

Parameters:
  • established (string) – part of the text that has been established
  • active (string) – part of the text to be completed
Return type:

list of strings

Returns:

potential completions