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

Method do__relative_run_script

cmd2/cmd2.py:5551–5563  ·  view source on GitHub ↗

Run text script. This command is intended to be used from within a text script. :return: True if running of commands should stop

(self, args: argparse.Namespace)

Source from the content-addressed store, hash-verified

5549
5550 @with_argparser(_build__relative_run_script_parser)
5551 def do__relative_run_script(self, args: argparse.Namespace) -> bool | None:
5552 """Run text script.
5553
5554 This command is intended to be used from within a text script.
5555
5556 :return: True if running of commands should stop
5557 """
5558 script_path = args.script_path
5559 # NOTE: Relative path is an absolute path, it is just relative to the current script directory
5560 relative_path = os.path.join(self._current_script_dir or "", script_path)
5561
5562 # self.last_result will be set by do_run_script()
5563 return self.do_run_script(su.quote(relative_path))
5564
5565 def add_alert(self, *, msg: str | None = None, prompt: str | None = None) -> None:
5566 """Queue an asynchronous alert to be displayed when the prompt is active.

Callers

nothing calls this directly

Calls 1

do_run_scriptMethod · 0.95

Tested by

no test coverage detected