aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--docs/README.md2
-rw-r--r--docs/res/guide.txt3
-rw-r--r--mingling/Cargo.toml2
-rw-r--r--mingling/src/example_docs.rs96
5 files changed, 51 insertions, 54 deletions
diff --git a/README.md b/README.md
index ba99f9d..77f6e52 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
<h1 align="center">Mìng Lìng - 命令</h1>
<p align="center">
- The Rust CLI Framework
+ Rust CLI framework for many subcmds & complex workflows, reduces boilerplate via proc macros, focus on biz logic
</p>
<p align="center">
<img src="https://img.shields.io/github/stars/CatilGrass/mingling?style=for-the-badge">
diff --git a/docs/README.md b/docs/README.md
index 2a341a7..84a961a 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -6,7 +6,7 @@
<h1 align="center">Mìng Lìng - 命令</h1>
<p align="center">
- The Rust CLI Framework
+ Rust CLI framework for many subcmds & complex workflows, reduces boilerplate via proc macros, focus on biz logic
</p>
<p align="center">
<img src="https://img.shields.io/github/stars/CatilGrass/mingling?style=for-the-badge">
diff --git a/docs/res/guide.txt b/docs/res/guide.txt
index a75037f..8f64d93 100644
--- a/docs/res/guide.txt
+++ b/docs/res/guide.txt
@@ -1,12 +1,9 @@
┌────────────────────────────────────┐
│ Mingling │
- │ The Rust CLI Framework │
- │ │
│ USE: │
│ Run command in your project │
│ > cargo add mingling │
│ │
│ Or add this to your Cargo.toml │
│ > mingling = "0.1.7" │
- │ │
└────────────────────────────────────┘
diff --git a/mingling/Cargo.toml b/mingling/Cargo.toml
index 4977a4d..e25c99c 100644
--- a/mingling/Cargo.toml
+++ b/mingling/Cargo.toml
@@ -5,7 +5,7 @@ edition = "2024"
authors = ["Weicao-CatilGrass"]
license = "MIT OR Apache-2.0"
readme = "README.md"
-description = "The Rust CLI Framework"
+description = "Rust CLI framework for many subcmds & complex workflows, reduces boilerplate via proc macros, focus on biz logic"
keywords = ["cli", "framework", "procedural", "subcommand", "command-line"]
categories = ["command-line-interface"]
repository = "https://github.com/catilgrass/mingling"
diff --git a/mingling/src/example_docs.rs b/mingling/src/example_docs.rs
index 519c5cc..8440a2d 100644
--- a/mingling/src/example_docs.rs
+++ b/mingling/src/example_docs.rs
@@ -1,21 +1,33 @@
// Auto generated
-/// `Mingling` Example - Basic
+/// `Mingling` Example - Async
+///
+/// After enabling the `async` feature:
+/// 1. The `chain!` macro will support using **async** functions,
+/// 2. The `exec` function of `Program` will return a `Future` for you to use with an async runtime
+///
+/// ## Enable Feature
+/// Enable the `async` feature for mingling in `Cargo.toml`
+/// ```toml
+/// [dependencies]
+/// mingling = { version = "...", features = ["async"] }
+/// ```
///
/// # How to Run
/// ```bash
-/// cargo run --manifest-path ./examples/example-basic/Cargo.toml -- hello World
+/// cargo run --manifest-path ./examples/example-async/Cargo.toml -- hello World
/// ```
///
/// Cargo.toml
/// ```ignore
/// [package]
-/// name = "example-basic"
+/// name = "example-async"
/// version = "0.0.1"
/// edition = "2024"
///
/// [dependencies]
-/// mingling = { path = "../../mingling" }
+/// tokio = { version = "1", features = ["full"] }
+/// mingling = { path = "../../mingling", features = ["async"] }
/// ```
///
/// main.rs
@@ -25,74 +37,54 @@
/// marker::NextProcess,
/// };
///
-/// // Define dispatcher `HelloCommand`, directing subcommand "hello" to `HelloEntry`
/// dispatcher!("hello", HelloCommand => HelloEntry);
///
-/// fn main() {
-/// // Create program
+/// // Use Tokio async runtime
+/// #[tokio::main]
+/// async fn main() {
/// let mut program = ThisProgram::new();
-///
-/// // Add dispatcher `HelloCommand`
/// program.with_dispatcher(HelloCommand);
///
/// // Run program
-/// program.exec();
+/// program.exec().await;
/// }
///
-/// // Register wrapper type `Hello`, setting inner to `String`
/// pack!(Hello = String);
///
-/// // Register chain to `ThisProgram`, handling logic from `HelloEntry`
+/// // You can freely use async / non-async functions to declare your Chain
+///
/// #[chain]
-/// fn parse_name(prev: HelloEntry) -> NextProcess {
-/// // Extract string from `HelloEntry` as argument
+/// // fn parse_name(prev: HelloEntry) -> NextProcess {
+/// async fn parse_name(prev: HelloEntry) -> NextProcess {
/// let name = prev.first().cloned().unwrap_or_else(|| "World".to_string());
-///
-/// // Build `Hello` type and route to renderer
/// Hello::new(name).to_render()
/// }
///
-/// // Register renderer to `ThisProgram`, handling rendering of `Hello`
+/// // For renderers, you can still only use synchronous functions
/// #[renderer]
/// fn render_hello_who(prev: Hello) {
-/// // Print message
/// r_println!("Hello, {}!", *prev);
-///
-/// // Program ends here
/// }
///
-/// // Generate program, default is `ThisProgram`
/// gen_program!();
/// ```
-pub mod example_basic {}
-/// `Mingling` Example - Async
-///
-/// After enabling the `async` feature:
-/// 1. The `chain!` macro will support using **async** functions,
-/// 2. The `exec` function of `Program` will return a `Future` for you to use with an async runtime
-///
-/// ## Enable Feature
-/// Enable the `async` feature for mingling in `Cargo.toml`
-/// ```toml
-/// [dependencies]
-/// mingling = { version = "...", features = ["async"] }
-/// ```
+pub mod example_async {}
+/// `Mingling` Example - Basic
///
/// # How to Run
/// ```bash
-/// cargo run --manifest-path ./examples/example-async/Cargo.toml -- hello World
+/// cargo run --manifest-path ./examples/example-basic/Cargo.toml -- hello World
/// ```
///
/// Cargo.toml
/// ```ignore
/// [package]
-/// name = "example-async"
+/// name = "example-basic"
/// version = "0.0.1"
/// edition = "2024"
///
/// [dependencies]
-/// tokio = { version = "1", features = ["full"] }
-/// mingling = { path = "../../mingling", features = ["async"] }
+/// mingling = { path = "../../mingling" }
/// ```
///
/// main.rs
@@ -102,38 +94,46 @@ pub mod example_basic {}
/// marker::NextProcess,
/// };
///
+/// // Define dispatcher `HelloCommand`, directing subcommand "hello" to `HelloEntry`
/// dispatcher!("hello", HelloCommand => HelloEntry);
///
-/// // Use Tokio async runtime
-/// #[tokio::main]
-/// async fn main() {
+/// fn main() {
+/// // Create program
/// let mut program = ThisProgram::new();
+///
+/// // Add dispatcher `HelloCommand`
/// program.with_dispatcher(HelloCommand);
///
/// // Run program
-/// program.exec().await;
+/// program.exec();
/// }
///
+/// // Register wrapper type `Hello`, setting inner to `String`
/// pack!(Hello = String);
///
-/// // You can freely use async / non-async functions to declare your Chain
-///
+/// // Register chain to `ThisProgram`, handling logic from `HelloEntry`
/// #[chain]
-/// // fn parse_name(prev: HelloEntry) -> NextProcess {
-/// async fn parse_name(prev: HelloEntry) -> NextProcess {
+/// fn parse_name(prev: HelloEntry) -> NextProcess {
+/// // Extract string from `HelloEntry` as argument
/// let name = prev.first().cloned().unwrap_or_else(|| "World".to_string());
+///
+/// // Build `Hello` type and route to renderer
/// Hello::new(name).to_render()
/// }
///
-/// // For renderers, you can still only use synchronous functions
+/// // Register renderer to `ThisProgram`, handling rendering of `Hello`
/// #[renderer]
/// fn render_hello_who(prev: Hello) {
+/// // Print message
/// r_println!("Hello, {}!", *prev);
+///
+/// // Program ends here
/// }
///
+/// // Generate program, default is `ThisProgram`
/// gen_program!();
/// ```
-pub mod example_async {}
+pub mod example_basic {}
/// `Mingling` Example - Completion
///
/// # How to Deploy