Skip to main content

more beautiful Typer

Project description

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()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rich_typer-0.1.4.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

rich_typer-0.1.4-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file rich_typer-0.1.4.tar.gz.

File metadata

  • Download URL: rich_typer-0.1.4.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Linux/5.13.0-1021-azure

File hashes

Hashes for rich_typer-0.1.4.tar.gz
Algorithm Hash digest
SHA256 79536b5dcd9ab3636cbbcec3e4c7f1019ac04ef9f169fc43f043b84f854df209
MD5 47bea15b01b28508b1c91e1c5628ee39
BLAKE2b-256 d7cf64e594d91edbc2c559d658d16f3a85fc8bb27dffc9f4608488f6b8a1779d

See more details on using hashes here.

File details

Details for the file rich_typer-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: rich_typer-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Linux/5.13.0-1021-azure

File hashes

Hashes for rich_typer-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5bd1996d9f9d497f8e711a5a37ace3e959154c68ca455000f8e2ca530e5c5dc1
MD5 33cfe95358eb2ca7e33eaa7894eec9f9
BLAKE2b-256 b137774fbc7868a669cef29073b088f10b4f7086b9fe2fffbe2ff9523b2b52a7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page