| 1 | """A simple example demonstrating a loadable command set.""" |
| 2 | |
| 3 | from cmd2 import ( |
| 4 | Cmd, |
| 5 | CommandSet, |
| 6 | Statement, |
| 7 | ) |
| 8 | |
| 9 | |
| 10 | class CustomInitCommandSet(CommandSet[Cmd]): |
| 11 | DEFAULT_CATEGORY = "Custom Init" |
| 12 | |
| 13 | def __init__(self, arg1, arg2) -> None: |
| 14 | super().__init__() |
| 15 | |
| 16 | self._arg1 = arg1 |
| 17 | self._arg2 = arg2 |
| 18 | |
| 19 | def do_show_arg1(self, _: Statement) -> None: |
| 20 | """Show Arg 1.""" |
| 21 | self._cmd.poutput("Arg1: " + self._arg1) |
| 22 | |
| 23 | def do_show_arg2(self, _: Statement) -> None: |
| 24 | """Show Arg 2.""" |
| 25 | self._cmd.poutput("Arg2: " + self._arg2) |