Print a message. Uses the given ANSI codes if specified. Does not add newline. Does not print color if the `NO_COLOR` environment variable is set.
(message: str, *codes: ANSI)
| 138 | |
| 139 | |
| 140 | def print_ansi(message: str, *codes: ANSI) -> None: |
| 141 | """Print a message. Uses the given ANSI codes if specified. Does not add newline. Does not print color if the `NO_COLOR` environment variable is set.""" |
| 142 | if len(codes) > 0 and not no_color: |
| 143 | seq = ";".join(str(c.value) for c in codes) |
| 144 | print(f"\033[{seq}m{message}\033[{ANSI.reset.value}m", end="") |
| 145 | else: |
| 146 | print(message, end="") |
| 147 | |
| 148 | |
| 149 | def print_if_verbose(message: str, *codes: ANSI) -> None: |
no outgoing calls
no test coverage detected