"""Debug Plugin for EasyEngine.""" from cement.core.controller import CementBaseController, expose from cement.core import handler, hook def debug_plugin_hook(app): # do something with the ``app`` object here. pass class EEDebugController(CementBaseController): class Meta: label = 'debug' description = 'debug command enables/disbaled stack debug' stacked_on = 'base' stacked_type = 'nested' arguments = [ (['--stop'], dict(help='Stop debug', action='store_true')), (['--start'], dict(help='Start debug', action='store_true')), (['--nginx'], dict(help='Debug Nginx', action='store_true')), (['--php'], dict(help='Debug PHP', action='store_true')), (['--fpm'], dict(help='Debug FastCGI', action='store_true')), (['--mysql'], dict(help='Debug MySQL', action='store_true')), (['--wp'], dict(help='Debug WordPress sites', action='store_true')), (['--rewrite'], dict(help='Debug Nginx rewrite rules', action='store_true')), (['-i', '--interactive'], dict(help='Interactive debug', action='store_true')), ] @expose(hide=True) def default(self): self.start = True if self.app.pargs.stop: self.start = False if self.app.pargs.nginx: pass if self.app.pargs.php: pass if self.app.pargs.fpm: pass if self.app.pargs.mysql: pass if self.app.pargs.wp: pass if self.app.pargs.rewrite: pass if self.app.pargs.interactive: pass def load(app): # register the plugin class.. this only happens if the plugin is enabled handler.register(EEDebugController) # register a hook (function) to run after arguments are parsed. hook.register('post_argument_parsing', debug_plugin_hook)