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)
| 38 | |
| 39 | |
| 40 | def 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 | |
| 56 | def main() -> None: |