Simple context used for default logic. The CLI registry which
registers the plugins installs itself as a fully functional Context.
The Context class is designed to increase pluggability. Rather than
making calls directly on other plugins directly, the pub() method routes
messages to other commands. Similarly, out() and err() should be used for
printing statements to the user, and die() should be used for exiting
fatally.
|
__init__(self,
controls={},
params={},
prog=sys.argv [0]) |
source code
|
|
|
post_process(self)
Runs further processing once all the controls have been added. |
source code
|
|
|
|
|
|
|
|
|
|
|
safePrint(self,
text,
stream,
newline=True)
Prints text to a given string, caputring any exceptions. |
source code
|
|
|
pythonpath(self)
Converts the current sys.path to a PYTHONPATH string to be used by
plugins which must start a new process. |
source code
|
|
|
userdir(self)
Returns a user directory (as path.path) which can be used for storing
configuration. |
source code
|
|
|
|
|
input(self,
prompt,
hidden=False,
required=False)
Reads from standard in. |
source code
|
|
|
out(self,
text,
newline=True)
Expects as single string as argument" |
source code
|
|
|
err(self,
text,
newline=True)
Expects a single string as argument. |
source code
|
|
|
dbg(self,
text,
newline=True,
level=1)
Passes text to err() if self.isdebug is set |
source code
|
|
|
|
|
|
|
|
|
|
|
|