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

Class SynonymCommandSet

tests/test_commandset.py:155–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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])

Callers 1

test_command_synonymsFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_command_synonymsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…