Basic Command-Line Controller. More...
Public Member Functions | |
def | __del__ |
Destroy a Horizon Demo. | |
def | __init__ |
Create A Horizon Command-Line Controller. | |
def | complete_repeat |
Repeat Command Tab Completion. | |
def | complete_subscribe |
Subscribe Command Tab Completion. | |
def | do_about |
About Horizon Device. | |
def | do_EOF |
Exit the Interactive Shell. | |
def | do_exit |
Exit the Interactive Shell. | |
def | do_get_time |
Horizon Device Time. | |
def | do_help |
List all Commands. | |
def | do_is_alive |
Horizon Device Alive? | |
def | do_quit |
Exit the Interactive Shell. | |
def | do_repeat |
Manipulate repeated commands. | |
def | do_subscribe |
Subscribe to Command. | |
def | emptyline |
Empty Line Action. | |
Public Attributes | |
doc_leader | |
intro | |
prompt | |
Private Member Functions | |
def | _about |
Get Horizon About String. | |
def | _arguments_to_values |
Convert Arguments to their Proper Types. | |
def | _extract_arguments |
Extract Arguments. | |
def | _handler |
Output Subscription Data. | |
def | _list_repeats |
List active repeat commands. | |
def | _parse_arguments |
Parse a Line of Arguments. | |
def | _print_help |
Prints a usage message for a command. | |
def | _remove_repeat |
Remove an active repeat command. | |
def | _repeat |
Command Repeater Loop. | |
def | _setup_repeat |
Subscribe to repeat a command at a specified interval. | |
def | _waiting |
Get Waiting Data. | |
def | _waiting_complete |
Get Waiting Command Tab Completion. | |
Private Attributes | |
_cmd_lock | |
_commands | |
Repetition Commands. | |
_horizon | |
Horizon Interface. | |
_output | |
Subscription Output. | |
_repeater | |
Repeat Thread. | |
_repeating | |
Repeat Looping? |
Basic Command-Line Controller.
Horizon Command-Line Controller
Interactive shell for controlling a Horizon device.
Horizon Command-Line Controller
Definition at line 239 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo.__init__ | ( | self, | |
port, | |||
horizon, | |||
output = '' |
|||
) |
Create A Horizon Command-Line Controller.
port | The device name to use in the prompt ('horizon:port$') |
horizon | The Horizon instance to send commands to. Must already be opened. |
output | Where to send subscription data? '' and '/dev/null' indicates nowhere and enables 'get_waiting' |
Create A Horizon Command-Line Controller
Definition at line 253 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo.__del__ | ( | self | ) |
Destroy a Horizon Demo.
Horizon Demo class destructor.
Stops the repeat thread if running.
Destroy a Horizon Demo.
Definition at line 342 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo._about | ( | self | ) | [private] |
Get Horizon About String.
Get Horizon About String
Definition at line 359 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo._arguments_to_values | ( | self, | |
params, | |||
method | |||
) | [private] |
Convert Arguments to their Proper Types.
Converts arguments based on given default values.
Prints argument errors to stdout.
params | The arguments to convert |
method | The method to convert for |
Convert arguments to their proper types.
Definition at line 514 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo._extract_arguments | ( | self, | |
arguments | |||
) | [private] |
Extract Arguments.
Extract arguments from a Line using whitespace as separators.
arguments | The line to extract from |
Extract arguments from a Line.
Definition at line 457 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo._handler | ( | self, | |
payload | |||
) | [private] |
Output Subscription Data.
Writes subscription data to the output file.
payload | The received payload |
Output Subscription Data
Definition at line 742 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo._list_repeats | ( | self | ) | [private] |
List active repeat commands.
Definition at line 1279 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo._parse_arguments | ( | self, | |
method, | |||
arguments | |||
) | [private] |
Parse a Line of Arguments.
Extracts arguments from a line for the given method.
Runs the method.
Outputs anything that is returned.
ValueErrors are treated as command argument errors.
method | The method to execute |
arguments | The string containing the whitespace separated arguments |
Parse a Line of Arguments
Definition at line 678 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo._print_help | ( | self, | |
method | |||
) | [private] |
Prints a usage message for a command.
Definition at line 711 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo._remove_repeat | ( | self, | |
arguments | |||
) | [private] |
Remove an active repeat command.
arguments | Command line arguments after 'repeat', assumed to be stripped. |
Definition at line 1299 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo._repeat | ( | self | ) | [private] |
Command Repeater Loop.
Repeater Thread method. Loops on _repeating waiting to send commands.
Command Repeater Loop
Definition at line 772 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo._setup_repeat | ( | self, | |
arguments | |||
) | [private] |
Subscribe to repeat a command at a specified interval.
arguments | Line entered after 'repeat' |
Definition at line 1334 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo._waiting | ( | self, | |
line | |||
) | [private] |
Get Waiting Data.
Outputs data retrieved from subscriptions.
line | The rest of the line |
syntax: get_waiting [<request>]\n
Definition at line 828 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo._waiting_complete | ( | self, | |
text, | |||
line, | |||
begidx, | |||
endidx | |||
) | [private] |
Get Waiting Command Tab Completion.
Calculates a list of possible paramters for get_waiting based on the entered prefix.
text | The last parameter before tab |
line | The entire line of text |
begidx | ??? |
endidx | ??? |
Get Waiting Command Tab Completion
Definition at line 908 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo.complete_repeat | ( | self, | |
text, | |||
line, | |||
begidx, | |||
endidx | |||
) |
Repeat Command Tab Completion.
Calculates a list of possible paramters for repeat based on the entered prefix.
text | The last parameter before tab |
line | The entire line of text |
begidx | ??? - Passed on to other functions |
endidx | ??? - Passed on to other functions |
Repeat Command Tab Completion
Definition at line 1424 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo.complete_subscribe | ( | self, | |
text, | |||
line, | |||
begidx, | |||
endidx | |||
) |
Subscribe Command Tab Completion.
Calculates a list of possible paramters for subscribe based on the entered prefix.
text | The last parameter before tab |
line | The entire line of text |
begidx | ??? - Passed on to other functions |
endidx | ??? - Passed on to other functions |
Subscribe Command Tab Completion
Definition at line 1195 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo.do_about | ( | self, | |
arguments | |||
) |
About Horizon Device.
Get information on the Horizon device.
arguments | Line entered after 'about' |
syntax: about \n
Definition at line 1003 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo.do_EOF | ( | self, | |
arg | |||
) |
Exit the Interactive Shell.
Stop the command loop
self | This object |
arg | Line entered after 'exit' |
syntax: ^d
Definition at line 1526 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo.do_exit | ( | self, | |
arg | |||
) |
Exit the Interactive Shell.
Stop the command loop
self | This object |
arg | Line entered after 'exit' |
syntax: exit
Definition at line 1509 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo.do_get_time | ( | self, | |
arguments | |||
) |
Horizon Device Time.
Get the Horizon device time.
arguments | Line entered after 'get_time' |
syntax: get_time \n
Definition at line 1049 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo.do_help | ( | self, | |
arg | |||
) |
List all Commands.
Overrides Cmd default to categorize Horizon messages.
syntax: help [<command>]\n
Definition at line 945 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo.do_is_alive | ( | self, | |
arguments | |||
) |
Horizon Device Alive?
Check if the Horizon device is alive.
arguments | Line entered after 'about' |
syntax: is_alive \n
Definition at line 1026 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo.do_quit | ( | self, | |
arg | |||
) |
Exit the Interactive Shell.
Stop the command loop
self | This object |
arg | Line entered after 'exit' |
syntax: quit
Definition at line 1492 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo.do_repeat | ( | self, | |
arguments | |||
) |
Manipulate repeated commands.
arguments | Line entered after 'repeat' |
usage: repeat [list | off [n] | [frequency command]]\n\n
Definition at line 1259 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo.do_subscribe | ( | self, | |
arguments | |||
) |
Subscribe to Command.
Subscribe to receive request data at a specified interval.
arguments | Line entered after 'subscribe' |
syntax: subscribe <frequency> <command>\n
Definition at line 1102 of file horizon/cli.py.
def clearpath.horizon.cli.HorizonDemo.emptyline | ( | self | ) |
Empty Line Action.
Does nothing when an empty line is entered rather than the default 'repeat last command'.
Empty Line Action
Definition at line 932 of file horizon/cli.py.
Definition at line 254 of file horizon/cli.py.
Repetition Commands.
Definition at line 254 of file horizon/cli.py.
Horizon Interface.
Definition at line 255 of file horizon/cli.py.
Subscription Output.
Definition at line 256 of file horizon/cli.py.
Repeat Thread.
Definition at line 257 of file horizon/cli.py.
Repeat Looping?
Definition at line 258 of file horizon/cli.py.
Definition at line 258 of file horizon/cli.py.
Definition at line 258 of file horizon/cli.py.
Definition at line 258 of file horizon/cli.py.