(
self,
prog,
indent_increment=2,
max_help_position=24,
width=None,
color=True,
)
| 162 | """ |
| 163 | |
| 164 | def __init__( |
| 165 | self, |
| 166 | prog, |
| 167 | indent_increment=2, |
| 168 | max_help_position=24, |
| 169 | width=None, |
| 170 | color=True, |
| 171 | ): |
| 172 | # default setting for width |
| 173 | if width is None: |
| 174 | import shutil |
| 175 | width = shutil.get_terminal_size().columns |
| 176 | width -= 2 |
| 177 | |
| 178 | self._set_color(color) |
| 179 | self._prog = prog |
| 180 | self._indent_increment = indent_increment |
| 181 | self._max_help_position = min(max_help_position, |
| 182 | max(width - 20, indent_increment * 2)) |
| 183 | self._width = width |
| 184 | |
| 185 | self._current_indent = 0 |
| 186 | self._level = 0 |
| 187 | self._action_max_length = 0 |
| 188 | |
| 189 | self._root_section = self._Section(self, None) |
| 190 | self._current_section = self._root_section |
| 191 | |
| 192 | self._whitespace_matcher = _re.compile(r'\s+', _re.ASCII) |
| 193 | self._long_break_matcher = _re.compile(r'\n\n\n+') |
| 194 | |
| 195 | def _set_color(self, color): |
| 196 | from _colorize import can_colorize, decolor, get_theme |
nothing calls this directly
no test coverage detected