python
from cement import App, Controller, ex
class MyAppController(Controller):
class Meta:
label = 'base'
description = 'My Application'
arguments = [
(['-n', '--name'], {'help': 'Your name', 'action': 'store'}),
]
@ex(help='Say hello')
def hello(self):
name = self.app.pargs.name or 'World'
self.app.log.info(f'Hello, {name}!')
class MyApp(App):
class Meta:
label = 'myapp'
handlers = [MyAppController]
def __init__(self):
super().__init__()
with MyApp() as app:
app.run()