Skip to main content

Cxalio Rich UI component library — declarative CLI interface components for terminal applications.

Project description

cx-wealth

语言 / Languages: 中文 | English

基于 Rich 的终端 UI 组件库,为 CLI 应用提供声明式帮助系统、标签渲染、详情面板和自适应布局等扩展。

安装

pip install cx-wealth

要求 Python >= 3.12, < 3.15。

组件

WealthHelp — 声明式帮助系统 DSL

替代 argparse 的原生帮助输出。通过 add_group / add_action / add_note 构建结构化帮助信息,支持 Rich 样式的主题化输出。

from cx_wealth import WealthHelp

help = WealthHelp(prog="myapp", description="My CLI tool")
help.add_action("--input", help="Input file path", nargs=1)
help.add_action("--output", help="Output file path", nargs=1)
help.add_group("Advanced", description="Advanced options")
help.add_note("See docs for more details.")

WealthLabel — 可组合标签渲染

将实现了 __rich_label__() 协议的对象渲染为带 Markup 和样式的紧凑文本行。支持 crop、ellipsis、fold 三种溢出处理方式,可自定义分隔符。

from cx_wealth import WealthLabelMixin

class MyItem(WealthLabelMixin):
    def __rich_label__(self):
        yield "[bold]MyItem[/]"
        yield "status: active"
        yield "[green]●[/]"

WealthDetail / WealthDetailPanel — 详情展示

将实现了 __rich_detail__() 协议的对象渲染为两列键值表格。支持子面板嵌套和 Rich 样式。

IndexedListPanel — 索引列表

在 Rich Panel 中显示带行号索引的列表。支持起始索引、最大行数控制(超出显示省略号)、边框样式自定义。

from cx_wealth import IndexedListPanel

panel = IndexedListPanel(items=["a", "b", "c"], title="Files")

DynamicColumns — 自适应多列布局

根据终端宽度自动计算列数和列宽,将对象集合渲染为多列布局。

链接

返回项目首页:cx-studio-tk

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

cx_wealth-0.8.0.1.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cx_wealth-0.8.0.1-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file cx_wealth-0.8.0.1.tar.gz.

File metadata

  • Download URL: cx_wealth-0.8.0.1.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for cx_wealth-0.8.0.1.tar.gz
Algorithm Hash digest
SHA256 8981b8f86dc5736e1e9533b8fd4f031682f6c432261c4007269c0e1356340ab5
MD5 b091b87558d54115d645a29a8de454eb
BLAKE2b-256 c737586b595e89a7cad37785ab6ef0dc0c40fcca7da2a390daa543a7b18b2dee

See more details on using hashes here.

File details

Details for the file cx_wealth-0.8.0.1-py3-none-any.whl.

File metadata

  • Download URL: cx_wealth-0.8.0.1-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for cx_wealth-0.8.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0887b213c7be17272fee9a7cabae395206b88dce5e63d797df1fdf5f1f3a8d7b
MD5 929fafdb31c39649908926a5b83ced96
BLAKE2b-256 337f569b0692ec5636738d47161a5d84f62be9618c3dd18e309660c1516465bf

See more details on using hashes here.

Supported by

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