aboutsummaryrefslogtreecommitdiff
path: root/azalea-brigadier/README.md
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2023-05-12 23:40:34 -0500
committermat <git@matdoes.dev>2023-05-12 23:40:34 -0500
commit49952dd1507d70cd63305ffbcae4b062dfb4ce68 (patch)
tree1b3e5bbd757634048988b9c8d96d5fb97f669427 /azalea-brigadier/README.md
parent657c073eab0f09d873bde21d5cdeb13a1bebb71b (diff)
parent2057877eba5f6f13ba6863b48a9cdd44910a44f8 (diff)
downloadazalea-drasl-49952dd1507d70cd63305ffbcae4b062dfb4ce68.tar.xz
Merge branch 'main' into 1.20
Diffstat (limited to 'azalea-brigadier/README.md')
-rwxr-xr-xazalea-brigadier/README.md21
1 files changed, 20 insertions, 1 deletions
diff --git a/azalea-brigadier/README.md b/azalea-brigadier/README.md
index c5aff629..6e573c8b 100755
--- a/azalea-brigadier/README.md
+++ b/azalea-brigadier/README.md
@@ -4,4 +4,23 @@ A Rust port of Mojang's [Brigadier](https://github.com/Mojang/brigadier) command
# Examples
-See the [tests](https://github.com/mat-1/azalea/tree/main/azalea-brigadier/tests).
+```rust
+use azalea_brigadier::prelude::*;
+use std::sync::Arc;
+
+#[derive(Debug, PartialEq)]
+struct CommandSource {}
+
+let mut subject = CommandDispatcher::new();
+subject.register(literal("foo").executes(|_| 42));
+
+assert_eq!(
+ subject
+ .execute("foo", Arc::new(CommandSource {}))
+ .unwrap(),
+ 42
+);
+```
+
+See the [tests](https://github.com/mat-1/azalea/tree/main/azalea-brigadier/tests) for more.
+