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

Function add_help_to_file

examples/scripts/save_help_text.py:40–53  ·  view source on GitHub ↗

Write help text for commands and topics to the output file :param item: what is having its help text saved :param outfile: file being written to :param is_command: tells if the item is a command and not just a help topic.

(item: str, outfile: TextIO, is_command: bool)

Source from the content-addressed store, hash-verified

38
39
40def add_help_to_file(item: str, outfile: TextIO, is_command: bool) -> None:
41 """Write help text for commands and topics to the output file
42
43 :param item: what is having its help text saved
44 :param outfile: file being written to
45 :param is_command: tells if the item is a command and not just a help topic.
46 """
47 label = "COMMAND" if is_command else "TOPIC"
48
49 header = f"{ASTERISKS}\n{label}: {item}\n{ASTERISKS}\n"
50 outfile.write(header)
51
52 result = app(f"help {item}")
53 outfile.write(result.stdout)
54
55
56def main() -> None:

Callers 1

mainFunction · 0.85

Calls 2

appFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…