(self, text, left="\u251C", right="\u2524", infill="\u2591", width=None)
| 103 | self.print_separator(left="\u2558", sep="\u2550", right="\u255B", **kwargs) |
| 104 | |
| 105 | def generate_heading(self, text, left="\u251C", right="\u2524", infill="\u2591", width=None): |
| 106 | if width is None: |
| 107 | width = self.width - len(left) - len(right) - 2 |
| 108 | |
| 109 | text_len = self.ansi_length(text) |
| 110 | ljust = (width - text_len) // 2 |
| 111 | rjust = width - text_len - ljust |
| 112 | return f"{left}{infill*ljust} {text} {infill*rjust}{right}" |
| 113 | |
| 114 | def print_heading(self, *args, **kwargs): |
| 115 | secho(self.generate_heading(*args, **kwargs), file=self.fd, color=TTY_COLORS) |
no test coverage detected