aboutsummaryrefslogtreecommitdiff
path: root/azalea-brigadier/README.md
blob: f18d253f738bd1a0d367b1ec2ab9d63977e5d6b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# `azalea-brigadier`

A Rust port of Mojang's [Brigadier](https://github.com/Mojang/brigadier) command parsing and dispatching library.

# Examples

```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/azalea-rs/azalea/tree/main/azalea-brigadier/tests) for more.