Add a huge bunch of docstrings

This commit is contained in:
Kristóf Tóth
2018-04-18 19:44:26 +02:00
parent 690f9bb190
commit addd517ba7
12 changed files with 183 additions and 0 deletions

View File

@ -10,6 +10,24 @@ LOG = logging.getLogger(__name__)
class TerminalCommands(ABC):
"""
A class you can use to define hooks for terminal commands. This means that you can
have python code executed when the user enters a specific command to the terminal on
our frontend.
To receive events you need to subscribe TerminalCommand.callback to a HistoryMonitor
instance.
Inherit from this class and define methods which start with "command_". When the user
executes the command specified after the underscore, your method will be invoked. All
such commands must expect the parameter *args which will contain the arguments of the
command.
For example to define a method that runs when someone starts vim in the terminal
you have to define a method like: "def command_vim(self, *args)"
You can also use this class to create new commands similarly.
"""
def __init__(self, bashrc=None):
self._command_method_regex = r'^command_(.+)$'
self.command_implemetations = self._build_command_to_implementation_dict()