We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should we color the command output in docs? As a proof of concept, I ran this in 3.14 with the following hack:
build.py
import os import re import subprocess import sysconfig from typing import Any import rich.console import rich.text def define_env(env: Any) -> None: "Hook function for mkdocs-macros" @env.macro # type: ignore[misc] def subprocess_run(*args: str) -> str: "Run a subprocess and return the stdout" env = os.environ.copy() scripts = sysconfig.get_path("scripts") env["PATH"] = f"{scripts}{os.pathsep}{env.get('PATH', '')}" env["PYTHON_COLORS"] = "1" output = subprocess.run(args, check=True, capture_output=True, text=True, env=env).stdout rich_text = rich.text.Text.from_ansi(output) console = rich.console.Console(record=True) console.print(rich_text) page = console.export_html(inline_styles=True) text = re.search(r"<body.*?>(.*?)</body>", page, re.DOTALL | re.IGNORECASE).group(1) return text.strip()
Result:
The text was updated successfully, but these errors were encountered:
I like it!
Sorry, something went wrong.
Out of curiosity, why is '-h' green in the output? Looks like a bug?
Maybe short options are green? That's in the CLI output too.
Successfully merging a pull request may close this issue.
Should we color the command output in docs? As a proof of concept, I ran this in 3.14 with the following hack:
build.py
Result:
The text was updated successfully, but these errors were encountered: