| Crates.io | bevy_commodore |
| lib.rs | bevy_commodore |
| version | 0.2.0 |
| created_at | 2025-10-09 18:26:53.147141+00 |
| updated_at | 2025-10-17 20:57:36.905897+00 |
| description | A text command framework for the bevy engine. |
| homepage | https://github.com/SunkenPotato/bevy_commodore |
| repository | https://github.com/SunkenPotato/bevy_commodore |
| max_upload_size | |
| id | 1876047 |
| size | 188,800 |
This is a text command framework for Bevy, largely inspired by Minecraft's Brigadier command parser & dispatcher.
To start, simply register your commands to your CommandPlugin plugin and add it to the app, e.g.:
use bevy::{DefaultPlugins, app::App};
use bevy_commodore::{CommandBuilder, CommandContext, CommandPlugin, CommandResult};
use std::fmt::Write;
fn echo_command_handler(In(mut ctx): In<CommandContext>) -> CommandResult {
let input = *tx.argument::<String>("input");
_ = writeln!(ctx, "{input}");
CommandResult::Ok
}
let mut app = App::new();
let plugin = CommandPlugin::<(), ()>::new();
let echo_command = CommandBuilder::new("echo", Some("Echoes the input text back to the user"), echo_command_handler);
echo_command.with_argument::<String>("input", None, false);
plugin.register_command(plugin);
app.add_plugins(DefaultPlugins);
app.add_plugins(plugin);
app.run();
[!NOTE] This example will work, but it will provide no way to call these commands. To supply input to the command plugin, use the
CommandInputevent. You'll be able to get the result of the command via theCommandOutputevent.
For a more detailed and fully functional example showcasing more features, you can view the examples/example.rs file.