MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / PluggedApp

Class PluggedApp

tests/test_plugin.py:264–284  ·  view source on GitHub ↗

A sample app with a plugin mixed in

Source from the content-addressed store, hash-verified

262
263
264class PluggedApp(Plugin, cmd2.Cmd):
265 """A sample app with a plugin mixed in"""
266
267 def __init__(self, *args, **kwargs) -> None:
268 super().__init__(*args, **kwargs)
269
270 def do_say(self, statement) -> None:
271 """Repeat back the arguments"""
272 self.poutput(statement)
273
274 def do_skip_postcmd_hooks(self, _) -> NoReturn:
275 self.poutput("In do_skip_postcmd_hooks")
276 raise exceptions.SkipPostcommandHooks
277
278 parser = Cmd2ArgumentParser(description="Test parser")
279 parser.add_argument("my_arg", help="some help text")
280
281 @with_argparser(parser)
282 def do_argparse_cmd(self, namespace: argparse.Namespace) -> None:
283 """Repeat back the arguments"""
284 self.poutput(namespace.cmd2_statement)
285
286
287###

Calls 1

Cmd2ArgumentParserClass · 0.90

Used in the wild real call sites across dependent graphs

searching dependent graphs…