From 3668b49c0d3423f1d5d10bb6b4a0e0e7b61f2046 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 3 Aug 2026 00:27:31 +0800 Subject: docs: Add preset feature groups and improve feature docs Add convenience presets (`mini`, `advanced`, `full`, `build_advanced`, `build_full`) to `mingling/Cargo.toml` and document them in both English and Chinese feature docs. Update getting-started guides to reflect the new default `core`/`macros` features. --- docs/_zh_CN/pages/1-getting-started.md | 2 +- docs/_zh_CN/pages/other/features.md | 60 +++++++++++++++++++++++++++++++++ docs/pages/1-getting-started.md | 2 +- docs/pages/other/features.md | 61 ++++++++++++++++++++++++++++++++++ 4 files changed, 123 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/_zh_CN/pages/1-getting-started.md b/docs/_zh_CN/pages/1-getting-started.md index 84870b2..2fca931 100644 --- a/docs/_zh_CN/pages/1-getting-started.md +++ b/docs/_zh_CN/pages/1-getting-started.md @@ -19,7 +19,7 @@ features = [] ## 启用特性 -**Mingling** 默认所有特性关闭,且不提供类似 `full` 的全开特性。 +**Mingling** 默认只启用 `core` 和 `macros`,其余部分需要按需启用 因为部分特性会 **直接影响整个生命周期的行为**,需要你按需启用,例如: diff --git a/docs/_zh_CN/pages/other/features.md b/docs/_zh_CN/pages/other/features.md index 84010c4..2d65e47 100644 --- a/docs/_zh_CN/pages/other/features.md +++ b/docs/_zh_CN/pages/other/features.md @@ -3,6 +3,66 @@ Mingling 的所有特性一览

+# 预设特性组 + +Mingling 提供了一系列**预设特性组**,方便用户按需组合启用特性。 + +## `mini` + +**启用特性:** `extras`、`picker` + +**定位:** 精简模式,适合小型 CLI 工具或需要快速起步的项目。仅包含最核心的便捷宏和参数解析能力。 + +## `advanced` + +**启用特性:** `extras`、`picker`、`repl`、`comp`、`dispatch_tree`、`structural_renderer` + +**定位:** 进阶模式,在 `mini` 的基础上加入了交互式 REPL 环境、代码补全、调度树加速以及基础的结构化输出能力,适合功能较完整的中型命令行应用。 + +## `full` + +**启用特性:** `extras`、`picker`、`repl`、`clap`、`comp`、`dispatch_tree`、`structural_renderer_full`、`pathf` + +**定位:** 完整模式,启用 Mingling 的全部核心功能。在 `advanced` 的基础上额外包含 clap 集成、完整的结构化渲染器(含所有序列化格式)以及实验性的路径分析器,适合大型、功能全面的命令行应用。 + +## `build_advanced` + +**启用特性:** `build`、`comp` + +**定位:** 构建期增强配置,用于在项目构建时生成补全脚本等构建辅助材料(`comp` 特性提供补全脚本生成能力)。 + +> [!NOTE] +> +> 此特性组为**构建依赖**专用,需配合 `advanced` 特性使用。请在 `Cargo.toml` 的 `[build-dependencies]` 中启用: + +```toml +[dependencies.mingling] +features = ["advanced"] + +[build-dependencies.mingling] +features = ["build_advanced"] +``` + +## `build_full` + +**启用特性:** `build`、`comp`、`pathf`、`dispatch_tree` + +**定位:** 完整的构建期配置,在 `build_advanced` 的基础上额外包含路径分析器(`pathf`)以自动解析类型模块路径,适合结构复杂、需要自动化构建期分析的项目。 + +> [!NOTE] +> +> 此特性组为**构建依赖**专用,需配合 `full` 特性使用。请在 `Cargo.toml` 的 `[build-dependencies]` 中启用: + +```toml +[dependencies.mingling] +features = ["full"] + +[build-dependencies.mingling] +features = ["build_full"] +``` + +# 特性详解 + ## 特性 `all_serde_fmt` **介绍:** diff --git a/docs/pages/1-getting-started.md b/docs/pages/1-getting-started.md index 2f31d69..8c81100 100644 --- a/docs/pages/1-getting-started.md +++ b/docs/pages/1-getting-started.md @@ -19,7 +19,7 @@ features = [] ## Enable Features -**Mingling** has all features disabled by default and does **not** provide an all-in-one feature like `full`. +**Mingling** by default only enables `core` and `macros`; the rest need to be enabled as needed. Some features **directly affect the entire lifecycle behavior**, so you need to enable them as needed, e.g.: diff --git a/docs/pages/other/features.md b/docs/pages/other/features.md index 465c290..55b6cc8 100644 --- a/docs/pages/other/features.md +++ b/docs/pages/other/features.md @@ -3,6 +3,67 @@ Mingling's complete feature list

+# Preset Feature Groups + +Mingling provides a set of **preset feature groups** that make it easy to enable features in whatever combination you need. + +## `mini` + +**Enables features:** `extras`, `picker` + +**Positioning:** Minimal mode, suitable for small CLI tools or projects that need to get started quickly. Includes only the most essential convenience macros and argument parsing capabilities. + +## `advanced` + +**Enables features:** `extras`, `picker`, `repl`, `comp`, `dispatch_tree`, `structural_renderer` + +**Positioning:** Advanced mode, builds on `mini` by adding an interactive REPL environment, code completion, dispatch tree acceleration, and basic structured output capabilities. Suitable for medium-sized command-line applications with a fuller feature set. + +## `full` + +**Enables features:** `extras`, `picker`, `repl`, `clap`, `comp`, `dispatch_tree`, `structural_renderer_full`, `pathf` + +**Positioning:** Full mode, enables all of Mingling's core functionality. In addition to `advanced`, it includes clap integration, the full structural renderer (with all serialization formats), and the experimental path analyzer. Suitable for large, feature-complete command-line applications. + +## `build_advanced` + +**Enables features:** `build`, `comp` + +**Positioning:** Build-time enhanced configuration, used to generate build helpers such as completion scripts at build time (the `comp` feature provides completion script generation). + +> [!NOTE] +> +> This feature group is intended for **build dependencies** only and must be used alongside the `advanced` feature. Enable it in the `[build-dependencies]` section of `Cargo.toml`: + +```toml +[dependencies.mingling] +features = ["advanced"] + +[build-dependencies.mingling] +features = ["build_advanced"] +``` + +## `build_full` + +**Enables features:** `build`, `comp`, `pathf`, `dispatch_tree` + +**Positioning:** Full build-time configuration, extends `build_advanced` with the path analyzer (`pathf`) to automatically resolve type module paths, suitable for projects with complex structures that require automated build-time analysis. + +> [!NOTE] +> +> This feature group is intended for **build dependencies** only and must be used alongside the `full` feature. Enable it in the `[build-dependencies]` section of `Cargo.toml`: + +```toml +[dependencies.mingling] +features = ["full"] + +[build-dependencies.mingling] +features = ["build_full"] +``` + +# Feature Details + + ## Feature `all_serde_fmt` **Description:** -- cgit