MCPcopy
hub / github.com/httpie/cli / _make_rich_console

Method _make_rich_console

httpie/context.py:188–205  ·  view source on GitHub ↗
(
        self,
        file: IO[str],
        force_terminal: bool
    )

Source from the content-addressed store, hash-verified

186 warnings.simplefilter("ignore")
187
188 def _make_rich_console(
189 self,
190 file: IO[str],
191 force_terminal: bool
192 ) -> 'Console':
193 from rich.console import Console
194 from httpie.output.ui.rich_palette import _make_rich_color_theme
195
196 style = getattr(self.args, 'style', None)
197 theme = _make_rich_color_theme(style)
198 # Rich infers the rest of the knowledge (e.g encoding)
199 # dynamically by looking at the file/stderr.
200 return Console(
201 file=file,
202 force_terminal=force_terminal,
203 no_color=(self.colors == 0),
204 theme=theme
205 )
206
207 # Rich recommends separating the actual console (stdout) from
208 # the error (stderr) console for better isolation between parts.

Callers 3

log_errorMethod · 0.95
rich_consoleMethod · 0.95
rich_error_consoleMethod · 0.95

Calls 1

_make_rich_color_themeFunction · 0.90

Tested by

no test coverage detected