Skip to main content

Rich Typer

介绍

本项目是将Rich和Typer结合在一起,将CLI打造的更加美观漂亮。

安装

pip install rich_typer

或者使用poetry 安装

git clone https://github.com/Elinpf/rich_typer
cd rich_typer
poetry build
pip install dist/<whl_file>

使用

完全兼容Typer语法,具体语法细节参考Typer官方文档

除此之外增加了如下几个参数:

  • banner 增加标题
  • banner_justify 标题位置
  • epilog_blend 底部信息的渐变色
  • usage 自定义Usage

Example

from rich_typer import RichTyper, Argument, Option


app = RichTyper()
banner = f"[b]Rich Typer[/b] [magenta][/] 🤑\n\n[dim]将 Rich 与 Typer 结合起来,使界面更加漂亮。\n"

url = "♥ https://github.com/Elinpf/rich_typer"


@app.command(banner=banner, banner_justify='center', epilog=url)
def main(
    name: str = Argument(...,
                         help="Name of the [green]person to greet[/]."),
    message: str = Option('ms', '-m', '--message',
                                help="The message [red]to[/] display"),
    version: bool = Option(False, '-v', '--version',
                           help="Show the [u]version[/] and exit"),
) -> None:
    """[bold][blue]Rich Typer[/] example."""
    ...


app()

Metadata

Release files for rich-typer 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rich-typer 0.1.7
File Size Uploaded Provenance Actions
rich_typer-0.1.7.tar.gz 9.0 kB Without provenance Details for rich_typer-0.1.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rich-typer 0.1.7
File Interpreter ABI Platform Actions
rich_typer-0.1.7-py3-none-any.whl Python 3 none any Details for rich_typer-0.1.7-py3-none-any.whl

Total release size: 19.7 kB

Release files / rich_typer-0.1.7.tar.gz

Download URL rich_typer-0.1.7.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
07caca4f38a0e5c7f7ee6bc2b32f51e0b65a39a74a25cad7b9bef7e7ed7bf007
BLAKE2b-256 checksum
How to use checksums
31a200f783e2491da079319a4587ad40ca0e495e71be00fd0f9885e0a46c8b37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.0 CPython/3.7.13 Linux/5.15.0-1019-azure

Release files / rich_typer-0.1.7-py3-none-any.whl

Download URL rich_typer-0.1.7-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0cb66c0fa89e9d61d8fd248ff35f909102896f1e175d53132804d3a1e7cd6215
BLAKE2b-256 checksum
How to use checksums
598ae9683580099676d3ad640850e9e9b4de194400765001e8659e29f9674d4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.0 CPython/3.7.13 Linux/5.15.0-1019-azure

Security for rich-typer 0.1.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page