azalea/azalea-brigadier/README.md

27 lines
566 B
Markdown
Raw Normal View History

2022-01-09 20:50:41 +00:00
# Azalea Brigadier
2022-04-18 17:59:21 +00:00
A Rust port of Mojang's [Brigadier](https://github.com/Mojang/brigadier) command parsing and dispatching library.
2023-01-30 22:05:18 +00:00
# Examples
2023-05-07 07:50:52 +00:00
```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
);
```
2023-10-08 08:58:57 +00:00
See the [tests](https://github.com/azalea-rs/azalea/tree/main/azalea-brigadier/tests) for more.
2023-05-07 07:50:52 +00:00