Controllers
Introduction to the Controller Interface
Application Base Controllers
from cement import App, Controller, ex
class Base(Controller):
class Meta:
label = 'base'
@ex(help='example sub-command')
def cmd1(self):
print('Inside Base.cmd1()')
class MyApp(App):
class Meta:
label = 'myapp'
handlers = [
Base,
]
with MyApp() as app:
app.run()$ python myapp.py
usage: myapp [-h] [-d] [-q] {cmd1} ...
optional arguments:
-h, --help show this help message and exit
-d, --debug full application debug mode
-q, --quiet suppress all console output
sub-commands:
{cmd1}
cmd1 example sub-command
$ python myapp.py cmd1
Inside Base.cmd1()Controller Arguments
Processing Controller Level Arguments
Additional Controllers and Namespaces
Last updated