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

Method app_cmd

tests/conftest.py:139–152  ·  view source on GitHub ↗

Run the application command :param command: The application command as it would be written on the cmd2 application prompt :param echo: Flag whether the command's output should be echoed to stdout/stderr :return: A CommandResult object that captures stdout, stderr, a

(self, command: str, echo: bool | None = None)

Source from the content-addressed store, hash-verified

137 self._pybridge = cmd2.py_bridge.PyBridge(self)
138
139 def app_cmd(self, command: str, echo: bool | None = None) -> cmd2.CommandResult:
140 """
141 Run the application command
142
143 :param command: The application command as it would be written on the cmd2 application prompt
144 :param echo: Flag whether the command's output should be echoed to stdout/stderr
145 :return: A CommandResult object that captures stdout, stderr, and the command's result object
146 """
147 try:
148 self._in_py = True
149 return self._pybridge(command, echo=echo)
150
151 finally:
152 self._in_py = False
153
154 def fixture_setup(self):
155 """Replicates the behavior of `cmdloop()` to prepare the application state for testing.

Callers 7

test_autoload_commandsFunction · 0.80
test_load_commandsFunction · 0.80
test_subcommandsFunction · 0.80
test_commandset_sigintFunction · 0.80
test_nested_subcommandsFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected