summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mingling_cli/Cargo.lock317
-rw-r--r--mingling_cli/Cargo.toml13
-rw-r--r--mingling_cli/MingLing.toml15
-rw-r--r--mingling_cli/src/add_dispatcher.rs38
-rw-r--r--mingling_cli/src/main.rs16
5 files changed, 399 insertions, 0 deletions
diff --git a/mingling_cli/Cargo.lock b/mingling_cli/Cargo.lock
new file mode 100644
index 0000000..d28a1c5
--- /dev/null
+++ b/mingling_cli/Cargo.lock
@@ -0,0 +1,317 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 4
+
+[[package]]
+name = "bitflags"
+version = "2.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af"
+
+[[package]]
+name = "bytes"
+version = "1.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"
+
+[[package]]
+name = "cfg-if"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
+
+[[package]]
+name = "errno"
+version = "0.3.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
+dependencies = [
+ "libc",
+ "windows-sys",
+]
+
+[[package]]
+name = "just_fmt"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5454cda0d57db59778608d7a47bff5b16c6705598265869fb052b657f66cf05e"
+
+[[package]]
+name = "libc"
+version = "0.2.184"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "48f5d2a454e16a5ea0f4ced81bd44e4cfc7bd3a507b61887c99fd3538b28e4af"
+
+[[package]]
+name = "lock_api"
+version = "0.4.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
+dependencies = [
+ "scopeguard",
+]
+
+[[package]]
+name = "mingling"
+version = "0.1.4"
+dependencies = [
+ "mingling_core",
+ "mingling_macros",
+ "size",
+]
+
+[[package]]
+name = "mingling_cli"
+version = "0.1.0"
+dependencies = [
+ "mingling",
+ "serde",
+ "tokio",
+]
+
+[[package]]
+name = "mingling_core"
+version = "0.1.3"
+dependencies = [
+ "just_fmt",
+ "thiserror",
+ "tokio",
+]
+
+[[package]]
+name = "mingling_macros"
+version = "0.1.3"
+dependencies = [
+ "just_fmt",
+ "once_cell",
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "mio"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1"
+dependencies = [
+ "libc",
+ "wasi",
+ "windows-sys",
+]
+
+[[package]]
+name = "once_cell"
+version = "1.21.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
+
+[[package]]
+name = "parking_lot"
+version = "0.12.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
+dependencies = [
+ "lock_api",
+ "parking_lot_core",
+]
+
+[[package]]
+name = "parking_lot_core"
+version = "0.9.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "redox_syscall",
+ "smallvec",
+ "windows-link",
+]
+
+[[package]]
+name = "pin-project-lite"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.106"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.45"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "redox_syscall"
+version = "0.5.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
+dependencies = [
+ "bitflags",
+]
+
+[[package]]
+name = "scopeguard"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
+
+[[package]]
+name = "serde"
+version = "1.0.228"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
+dependencies = [
+ "serde_core",
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_core"
+version = "1.0.228"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.228"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "signal-hook-registry"
+version = "1.4.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b"
+dependencies = [
+ "errno",
+ "libc",
+]
+
+[[package]]
+name = "size"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1b6709c7b6754dca1311b3c73e79fcce40dd414c782c66d88e8823030093b02b"
+
+[[package]]
+name = "smallvec"
+version = "1.15.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
+
+[[package]]
+name = "socket2"
+version = "0.6.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e"
+dependencies = [
+ "libc",
+ "windows-sys",
+]
+
+[[package]]
+name = "syn"
+version = "2.0.117"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "thiserror"
+version = "2.0.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"
+dependencies = [
+ "thiserror-impl",
+]
+
+[[package]]
+name = "thiserror-impl"
+version = "2.0.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "tokio"
+version = "1.51.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2bd1c4c0fc4a7ab90fc15ef6daaa3ec3b893f004f915f2392557ed23237820cd"
+dependencies = [
+ "bytes",
+ "libc",
+ "mio",
+ "parking_lot",
+ "pin-project-lite",
+ "signal-hook-registry",
+ "socket2",
+ "tokio-macros",
+ "windows-sys",
+]
+
+[[package]]
+name = "tokio-macros"
+version = "2.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
+
+[[package]]
+name = "wasi"
+version = "0.11.1+wasi-snapshot-preview1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
+
+[[package]]
+name = "windows-link"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
+
+[[package]]
+name = "windows-sys"
+version = "0.61.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
+dependencies = [
+ "windows-link",
+]
diff --git a/mingling_cli/Cargo.toml b/mingling_cli/Cargo.toml
new file mode 100644
index 0000000..7929eb7
--- /dev/null
+++ b/mingling_cli/Cargo.toml
@@ -0,0 +1,13 @@
+[package]
+name = "mingling_cli"
+version = "0.1.0"
+edition = "2024"
+
+[[bin]]
+name = "mling"
+path = "src/main.rs"
+
+[dependencies]
+mingling = { path = "../mingling", features = ["parser"] }
+serde = { version = "1", features = ["derive"] }
+tokio = { version = "1", features = ["full"] }
diff --git a/mingling_cli/MingLing.toml b/mingling_cli/MingLing.toml
new file mode 100644
index 0000000..f950387
--- /dev/null
+++ b/mingling_cli/MingLing.toml
@@ -0,0 +1,15 @@
+[[program]]
+name = "MinglingCLI"
+dispatchers = [
+ "src/add_dispatcher.rs"
+]
+
+[[dispatcher]]
+bind = "MinglingCLI"
+name = "AddDispatcherCommand"
+route = "AddDispatcherEntry"
+
+[[chain]]
+bind = "MinglingCLI"
+name = "ParseAddDispatcherArgument"
+mount = "AddDispatcherEntry"
diff --git a/mingling_cli/src/add_dispatcher.rs b/mingling_cli/src/add_dispatcher.rs
new file mode 100644
index 0000000..c5eaec4
--- /dev/null
+++ b/mingling_cli/src/add_dispatcher.rs
@@ -0,0 +1,38 @@
+use mingling::{
+ AnyOutput,
+ macros::{chain, dispatcher, pack, r_println, renderer},
+ marker::NextProcess,
+ parser::Picker,
+};
+
+use crate::MinglingCLI;
+
+dispatcher!(MinglingCLI, "add.dispatcher", AddDispatcherCommand => AddDispatcherEntry);
+
+#[chain(MinglingCLI)]
+pub async fn parse_add_dispatcher(args: AddDispatcherEntry) -> NextProcess {
+ let picker: Picker<MinglingCLI> = Picker::new(args.inner);
+ let dispatcher_name = picker.pick::<String>(()).unpack_directly().0;
+ let input = AddDispatcherInput::new(dispatcher_name);
+ input.into()
+}
+
+pack!(MinglingCLI, AddDispatcherInput = String);
+
+#[chain(MinglingCLI)]
+pub async fn exec_add_dispatcher(_input: AddDispatcherInput) -> NextProcess {
+ AnyOutput::new(AddDispatcherSuccess::new(())).route_chain()
+}
+
+pack!(MinglingCLI, AddDispatcherSuccess = ());
+pack!(MinglingCLI, AddDispatcherFailed = String);
+
+#[renderer(MinglingCLI)]
+pub fn render_add_dispatcher_success(_prev: AddDispatcherSuccess) {
+ r_println!("Dispatcher added successfully");
+}
+
+#[renderer(MinglingCLI)]
+pub fn render_add_dispatcher_failed(prev: AddDispatcherFailed) {
+ r_println!("Error: {}", prev.inner);
+}
diff --git a/mingling_cli/src/main.rs b/mingling_cli/src/main.rs
new file mode 100644
index 0000000..c4dfe21
--- /dev/null
+++ b/mingling_cli/src/main.rs
@@ -0,0 +1,16 @@
+use mingling::{macros::gen_program, setup::BasicProgramSetup};
+
+mod add_dispatcher;
+pub use crate::add_dispatcher::*;
+
+#[tokio::main]
+async fn main() {
+ let mut program = MinglingCLI::new();
+ program.with_setup(BasicProgramSetup);
+ program.with_dispatcher(AddDispatcherCommand);
+
+ let render_result = program.exec_without_render().await.unwrap();
+ println!("{}", render_result);
+}
+
+gen_program!(MinglingCLI);