| 465 | |
| 466 | |
| 467 | class LoadableFruits(cmd2.CommandSet): |
| 468 | DEFAULT_CATEGORY = "Fruits" |
| 469 | |
| 470 | def __init__(self, dummy) -> None: |
| 471 | super().__init__() |
| 472 | self._dummy = dummy # prevents autoload |
| 473 | |
| 474 | def do_apple(self, _: cmd2.Statement) -> None: |
| 475 | """Apple Command""" |
| 476 | self._cmd.poutput("Apple") |
| 477 | |
| 478 | banana_parser = cmd2.Cmd2ArgumentParser() |
| 479 | banana_parser.add_argument("direction", choices=["discs", "lengthwise"]) |
| 480 | |
| 481 | @cmd2.as_subcommand_to("cut", "banana", banana_parser, help="Cut banana", aliases=["bananer"]) |
| 482 | def cut_banana(self, ns: argparse.Namespace) -> None: |
| 483 | """Cut banana""" |
| 484 | self._cmd.poutput("cutting banana: " + ns.direction) |
| 485 | |
| 486 | |
| 487 | class LoadablePastaStir(cmd2.CommandSet): |
no outgoing calls
searching dependent graphs…