aboutsummaryrefslogtreecommitdiff
path: root/docs/examples.json
diff options
context:
space:
mode:
Diffstat (limited to 'docs/examples.json')
-rw-r--r--docs/examples.json393
1 files changed, 393 insertions, 0 deletions
diff --git a/docs/examples.json b/docs/examples.json
new file mode 100644
index 0000000..dd5b65b
--- /dev/null
+++ b/docs/examples.json
@@ -0,0 +1,393 @@
+[
+ {
+ "id": "example-basic",
+ "name": "Basic",
+ "icon": "🚀",
+ "category": "core",
+ "desc": "Demonstrates the basic usage of Mingling with a simple `greet` subcommand that takes a name and prints a greeting.\n",
+ "tags": [
+ "dispatcher!",
+ "#[chain]",
+ "#[renderer]"
+ ],
+ "files": [
+ "src/main.rs",
+ "Cargo.toml"
+ ]
+ },
+ {
+ "id": "example-argument-picker",
+ "name": "Argument Picker",
+ "icon": "📋",
+ "category": "parsing",
+ "desc": "Demonstrates how to use Mingling's `picker` feature and `Picker` to extract typed arguments from the command line.\n",
+ "tags": [
+ "arg-picker",
+ "SinglePickable"
+ ],
+ "files": [
+ "src/main.rs",
+ "Cargo.toml"
+ ]
+ },
+ {
+ "id": "example-async-support",
+ "name": "Async Support",
+ "icon": "⚡",
+ "category": "runtime",
+ "desc": "Shows how to drive an async runtime with Mingling using the `async` feature, enabling `async fn` in `#[chain]` with tokio.\n",
+ "tags": [
+ "async",
+ "await",
+ "#[chain]"
+ ],
+ "files": [
+ "src/main.rs",
+ "Cargo.toml"
+ ]
+ },
+ {
+ "id": "example-clap-binding",
+ "name": "Clap Binding",
+ "icon": "🔗",
+ "category": "parsing",
+ "desc": "Demonstrates how to bind a `clap::Parser` derive struct to Mingling using `#[dispatcher_clap]` for advanced argument parsing.\n",
+ "tags": [
+ "clap"
+ ],
+ "files": [
+ "src/main.rs",
+ "Cargo.toml"
+ ]
+ },
+ {
+ "id": "example-combine-pathf-dispatch-tree",
+ "name": "Pathfinder + Dispatch Tree",
+ "icon": "🧭",
+ "category": "advanced",
+ "desc": "Demonstrates combining the `pathf` and `dispatch_tree` features. Types are defined in submodules and automatically resolved. Requires `dispatch_tree` in both `[dependencies]` and `[build-dependencies]`.\n",
+ "tags": [
+ "pathf",
+ "dispatch_tree",
+ "extras"
+ ],
+ "files": [
+ "src/main.rs",
+ "src/sub/mod.rs",
+ "Cargo.toml"
+ ]
+ },
+ {
+ "id": "example-combine-pathf-metadata",
+ "name": "Pathfinder + Metadata",
+ "icon": "🧭",
+ "category": "advanced",
+ "desc": "Combines the `pathf` feature with entry metadata. The metadata `DataType` and the entry `BindType` are defined inside a submodule, and `pathf` resolves them for `gen_program!()` at build time.\n",
+ "tags": [
+ "pathf",
+ "metadata"
+ ],
+ "files": [
+ "src/main.rs",
+ "src/sub/mod.rs",
+ "Cargo.toml"
+ ]
+ },
+ {
+ "id": "example-command-macro",
+ "name": "Command Macro",
+ "icon": "🚀",
+ "category": "advanced",
+ "desc": "Introduced how to use the `#[command]` macro to generate commands with minimal boilerplate\n",
+ "tags": [
+ "#[command]",
+ "dispatcher!",
+ "#[chain]"
+ ],
+ "files": [
+ "src/main.rs",
+ "Cargo.toml"
+ ]
+ },
+ {
+ "id": "example-completion",
+ "name": "Completion",
+ "icon": "🔄",
+ "category": "ux",
+ "desc": "Demonstrates how to implement dynamic shell completion with `#[completion]` and generate scripts for bash, zsh, fish, and pwsh.\n",
+ "tags": [
+ "comp"
+ ],
+ "files": [
+ "src/main.rs",
+ "Cargo.toml"
+ ]
+ },
+ {
+ "id": "example-dispatch-tree",
+ "name": "Dispatch Tree",
+ "icon": "🌳",
+ "category": "dispatch",
+ "desc": "Introduces the `dispatch_tree` feature that converts the subcommand list into a compile-time prefix trie for O(n) command lookup.\n",
+ "tags": [
+ "dispatch_tree"
+ ],
+ "files": [
+ "src/main.rs",
+ "Cargo.toml"
+ ]
+ },
+ {
+ "id": "example-enum-tag",
+ "name": "Enum Tag",
+ "icon": "🏷️",
+ "category": "parsing",
+ "desc": "Shows how to derive `EnumTag` on enums for parsing variants from CLI strings with renames and descriptions.\n",
+ "tags": [
+ "enum_tag",
+ "Pickable"
+ ],
+ "files": [
+ "src/main.rs",
+ "Cargo.toml"
+ ]
+ },
+ {
+ "id": "example-error-handling",
+ "name": "Error Handling",
+ "icon": "⚠️",
+ "category": "runtime",
+ "desc": "Demonstrates how to define custom error types with `pack!` and route them to dedicated `#[renderer]` functions for user-friendly output.\n",
+ "tags": [
+ "Result"
+ ],
+ "files": [
+ "src/main.rs",
+ "Cargo.toml"
+ ]
+ },
+ {
+ "id": "example-exitcode",
+ "name": "Exitcode",
+ "icon": "🚪",
+ "category": "runtime",
+ "desc": "Shows how to set custom exit codes using `ExitCodeSetup` and the `finish` hook to signal success or failure to the shell.\n",
+ "tags": [
+ "ExitCode"
+ ],
+ "files": [
+ "src/main.rs",
+ "Cargo.toml"
+ ]
+ },
+ {
+ "id": "example-help",
+ "name": "Help",
+ "icon": "💡",
+ "category": "ux",
+ "desc": "Shows how to use the `#[help]` attribute to provide custom per-command help text that activates when the user passes `--help`.\n",
+ "tags": [
+ "#[help]"
+ ],
+ "files": [
+ "src/main.rs",
+ "Cargo.toml"
+ ]
+ },
+ {
+ "id": "example-hook",
+ "name": "Hook",
+ "icon": "🪝",
+ "category": "runtime",
+ "desc": "Demonstrates how to use Mingling's `ProgramHook` system to observe and debug every stage of the execution pipeline.\n",
+ "tags": [
+ "ProgramHook"
+ ],
+ "files": [
+ "src/main.rs",
+ "Cargo.toml"
+ ]
+ },
+ {
+ "id": "example-implicit-dispatcher",
+ "name": "Implicit Dispatcher",
+ "icon": "🫥",
+ "category": "dispatch",
+ "desc": "Shows the abbreviated `dispatcher!(\"cmd.path\")` syntax from `extras` that auto-derives struct names from the command path.\n",
+ "tags": [
+ "implicit"
+ ],
+ "files": [
+ "src/main.rs",
+ "Cargo.toml"
+ ]
+ },
+ {
+ "id": "example-lazy-resources",
+ "name": "Lazy Resources",
+ "icon": "💤️",
+ "category": "advanced",
+ "desc": "Demonstrates how to use `LazyRes<T>` for lazily initialized resources that only allocate when first accessed.\n",
+ "tags": [
+ "LazyRes<Res>"
+ ],
+ "files": [
+ "src/main.rs",
+ "Cargo.toml"
+ ]
+ },
+ {
+ "id": "example-metadata",
+ "name": "Entry Metadata",
+ "icon": "🏷️",
+ "category": "advanced",
+ "desc": "Demonstrates attaching arbitrary, compile-time-typed metadata to an entry via `#[metadata(Entry)]` and retrieving it at runtime with `ProgramCollect::get_metadata`. No `pathf` needed here — everything lives in a single module.\n",
+ "tags": [
+ "metadata",
+ "get_metadata",
+ "extras"
+ ],
+ "files": [
+ "src/main.rs",
+ "Cargo.toml"
+ ]
+ },
+ {
+ "id": "example-outside-type",
+ "name": "Outside Type",
+ "icon": "🆕",
+ "category": "advanced",
+ "desc": "Demonstrates how to use the `group!()` macro to convert an external type into a type recognizable by Mingling\n",
+ "tags": [
+ "group!",
+ "extras"
+ ],
+ "files": [
+ "src/main.rs",
+ "Cargo.toml"
+ ]
+ },
+ {
+ "id": "example-panic-unwind",
+ "name": "Panic Unwind",
+ "icon": "💥",
+ "category": "runtime",
+ "desc": "Shows how to catch panics during program execution and display friendly error messages instead of a raw panic trace.\n",
+ "tags": [
+ "panic_unwind"
+ ],
+ "files": [
+ "src/main.rs",
+ "Cargo.toml"
+ ]
+ },
+ {
+ "id": "example-pathfinder",
+ "name": "Module Pathfinder",
+ "icon": "🧭",
+ "category": "advanced",
+ "desc": "Demonstrates the `pathf` feature, which automatically resolves type module paths at build time. Types can be defined in submodules without explicit `use` in the main module.\n",
+ "tags": [
+ "pathf",
+ "architecture"
+ ],
+ "files": [
+ "Cargo.toml",
+ "src/main.rs",
+ "src/sub/mod.rs"
+ ]
+ },
+ {
+ "id": "example-repl-basic",
+ "name": "REPL Basic",
+ "icon": "🔁",
+ "category": "repl",
+ "desc": "Demonstrates how to build an interactive REPL shell with Mingling using `exec_repl()`, custom prompts, and built-in setups.\n",
+ "tags": [
+ "repl"
+ ],
+ "files": [
+ "src/main.rs",
+ "Cargo.toml"
+ ]
+ },
+ {
+ "id": "example-resources",
+ "name": "Resources",
+ "icon": "📦",
+ "category": "advanced",
+ "desc": "Shows how to share global state across commands using `with_resource()` and inject `&T` or `&mut T` into chain and renderer functions.\n",
+ "tags": [
+ "Resources",
+ "injection"
+ ],
+ "files": [
+ "src/main.rs",
+ "Cargo.toml"
+ ]
+ },
+ {
+ "id": "example-setup",
+ "name": "Setup",
+ "icon": "🏗️",
+ "category": "core",
+ "desc": "Demonstrates how to build a custom `ProgramSetup` with `#[program_setup]` for modular configuration of program behaviour.\n",
+ "tags": [
+ "#[setup]",
+ "extras"
+ ],
+ "files": [
+ "src/main.rs",
+ "Cargo.toml"
+ ]
+ },
+ {
+ "id": "example-structural-renderer",
+ "name": "structural renderer",
+ "icon": "📤",
+ "category": "output",
+ "desc": "Demonstrates how to render structured output in JSON or YAML using `StructuralRendererSetup` and the `structural_renderer` feature.\n",
+ "tags": [
+ "structural_renderer",
+ "--json",
+ "--yaml"
+ ],
+ "files": [
+ "src/main.rs",
+ "Cargo.toml"
+ ]
+ },
+ {
+ "id": "example-unit-test",
+ "name": "Unit Test",
+ "icon": "🧪",
+ "category": "testing",
+ "desc": "Shows how to write unit tests for Chain and Renderer functions using the `entry!` macro and assertion helpers.\n",
+ "tags": [
+ "testing",
+ "extras"
+ ],
+ "files": [
+ "src/main.rs",
+ "Cargo.toml"
+ ]
+ },
+ {
+ "id": "full-todolist",
+ "name": "Todo List",
+ "icon": "📝",
+ "category": "full",
+ "desc": "This is a complete example project that demonstrates how to develop a todo list application using Mingling\n",
+ "tags": [
+ "todolist",
+ "CRUD",
+ "cliché example"
+ ],
+ "files": [
+ "src/main.rs",
+ "src/todolist.rs",
+ "src/help.rs",
+ "Cargo.toml"
+ ]
+ }
+] \ No newline at end of file