| 153 | """Test the use of command synonyms in CommandSets""" |
| 154 | |
| 155 | class SynonymCommandSet(cmd2.CommandSet): |
| 156 | def __init__(self, arg1) -> None: |
| 157 | super().__init__() |
| 158 | self._arg1 = arg1 |
| 159 | |
| 160 | @cmd2.with_argparser(cmd2.Cmd2ArgumentParser(description="Native Command")) |
| 161 | def do_builtin(self, _) -> None: |
| 162 | """Builtin Command""" |
| 163 | |
| 164 | # Create a synonym to a command inside of this CommandSet |
| 165 | do_builtin_synonym = do_builtin |
| 166 | |
| 167 | # Create a synonym to a command outside of this CommandSet with subcommands. |
| 168 | # This will best test the synonym check in cmd2.Cmd._check_uninstallable() when |
| 169 | # we unregister this CommandSet. |
| 170 | do_alias_synonym = cmd2.Cmd.do_alias |
| 171 | |
| 172 | cs = SynonymCommandSet("foo") |
| 173 | app = WithCommandSets(command_sets=[cs]) |
no outgoing calls
searching dependent graphs…