format_output_for_docs
format_output_for_docs(command: Sequence[str], *, width: int = 60)Run a command and display compact, colored output in docs.
This strips newlines, makes the output more narrow, enable overflow instead of wrapping, and remaps some colors. Currently everything except the output width is hard-coded to a certain style that emulates the look of the output when running in the terminal, but this could be parametrized later if the need arises.
Parameters
command : Sequence[str]-
The command to run, as a list of strings.
width : int = 60-
The terminal width used when rendering command output.
Examples
To run the command cdp check --strict and format the output:
format_output_for_docs(["cdp", "check", "--strict"])