Skip to main content

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

Project description

cx-wealth

⚠️ 已弃用 / DEPRECATED

本包自 v0.9.0 起正式弃用,不再接收新功能或维护更新。

请迁移至 cx-wealthy —— 全新设计的 Rich UI 组件库,不依赖 cx-studio,更轻量、更灵活。

This package is deprecated since v0.9.0. No further updates will be provided. Please migrate to cx-wealthy instead.

语言 / 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.9.0.tar.gz (14.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.9.0-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cx_wealth-0.9.0.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","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.9.0.tar.gz
Algorithm Hash digest
SHA256 dac5bff7c2eebf6edb705fcf95b468c4bfb5a0020711308bdc7f58cce6c8caa9
MD5 b23b9db352a3b80878a63f039f6e51b8
BLAKE2b-256 4d16b6297efff1dd8aad608dfdccd275415453d4c04d296a6dd5be8696e7dba8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cx_wealth-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","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.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 73975e732a7394047d9a7990dd00ca71fbc303221cad301881340d0178c45acb
MD5 d2a1d99a0ebf6afe9a2a02a3a18dad40
BLAKE2b-256 22f9fc60fed8a609c087baa60292a3edd8b01f9c3dbd02e0a672ec0136194ccb

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