diff options
| author | mat <git@matdoes.dev> | 2023-05-07 02:50:52 -0500 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2023-05-07 02:50:52 -0500 |
| commit | 53d51a5ca92aa8ddea9d82b6b44ac7aaa06c2095 (patch) | |
| tree | 52ea13066f52bf46529debc0312ae420a295702a /azalea-brigadier/README.md | |
| parent | 2823e508b389194ee1d8b3f4180fc3a15a7e077e (diff) | |
| download | azalea-drasl-53d51a5ca92aa8ddea9d82b6b44ac7aaa06c2095.tar.xz | |
more brigadier docs
Diffstat (limited to 'azalea-brigadier/README.md')
| -rwxr-xr-x | azalea-brigadier/README.md | 21 |
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. + |
