A sample app with a plugin mixed in
| 262 | |
| 263 | |
| 264 | class 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 | ### |
searching dependent graphs…