aboutsummaryrefslogtreecommitdiff
path: root/mingling_picker
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-07-14 17:38:22 +0800
committer魏曹先生 <1992414357@qq.com>2026-07-14 17:38:22 +0800
commita18efb4aaaab51cb9ef1663f58286747e2e951ee (patch)
tree1fb0c112290884ab782b8dd6a0e4d5b294e34e85 /mingling_picker
parent5d1805cf4b096844f8efbe303479ec7b23a054ce (diff)
feat(picker): add parselib module and README
Diffstat (limited to 'mingling_picker')
-rw-r--r--mingling_picker/README.md35
-rw-r--r--mingling_picker/src/lib.rs2
-rw-r--r--mingling_picker/src/parselib.rs0
3 files changed, 37 insertions, 0 deletions
diff --git a/mingling_picker/README.md b/mingling_picker/README.md
index e69de29..efd72ad 100644
--- a/mingling_picker/README.md
+++ b/mingling_picker/README.md
@@ -0,0 +1,35 @@
+# Mingling Picker
+
+A command-line argument parser for [Mingling](https://github.com/mingling-rs/mingling), enabled by the `mingling/picker` feature.
+
+```toml
+[dependencies.mingling]
+version = "0.3.0"
+features = [
+ "picker"
+]
+```
+
+## Chained Argument Parser
+
+Provides a clean chained-call API for declaring arguments to parse:
+
+```rust
+let args: Vec<&str> = vec!["--name", "Bob", "--age", "24"];
+let result = args
+ .pick(&flag![name: String])
+ .or(|| "Alice".to_string())
+ .pick(&flag![age: i32])
+ .or(|| 24)
+ .post(|num| num.clamp(0, 120))
+ .parse();
+let (name, age): (String, i32) = a.unwrap();
+```
+
+## Parsing Function Library
+
+Provides a pure function library `parselib` for analyzing the structure of command-line arguments.
+
+```rust
+use mingling::picker::parselib::*;
+```
diff --git a/mingling_picker/src/lib.rs b/mingling_picker/src/lib.rs
index a2f3995..4056283 100644
--- a/mingling_picker/src/lib.rs
+++ b/mingling_picker/src/lib.rs
@@ -10,6 +10,8 @@ pub use flag::*;
mod result;
pub use result::*;
+pub mod parselib;
+
pub mod prelude {
pub use crate::IntoPicker;
}
diff --git a/mingling_picker/src/parselib.rs b/mingling_picker/src/parselib.rs
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/mingling_picker/src/parselib.rs