bevy_commodore

Crates.iobevy_commodore
lib.rsbevy_commodore
version0.2.0
created_at2025-10-09 18:26:53.147141+00
updated_at2025-10-17 20:57:36.905897+00
descriptionA text command framework for the bevy engine.
homepagehttps://github.com/SunkenPotato/bevy_commodore
repositoryhttps://github.com/SunkenPotato/bevy_commodore
max_upload_size
id1876047
size188,800
SunkenPotato (SunkenPotato)

documentation

README

bevy_commodore

This is a text command framework for Bevy, largely inspired by Minecraft's Brigadier command parser & dispatcher.

Features

  • Multiple simultaneous command and argument registries
  • Custom argument types
  • Optional arguments
  • (Nested) subcommands

Getting started

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 CommandInput event. You'll be able to get the result of the command via the CommandOutput event.

For a more detailed and fully functional example showcasing more features, you can view the examples/example.rs file.

Roadmap

  • Variadic arguments
  • Help for subcommands
Commit count: 0

cargo fmt