Skip to content

graysonrie/bevy-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Helper - Bevy Entity Module Generator

A CLI tool for quickly scaffolding Bevy entity modules with a standardized structure.

Installation

For Development

To install the tool to your PATH for development use:

cargo install --path .

This will compile and install the helper binary to ~/.cargo/bin (or %USERPROFILE%\.cargo\bin on Windows), which should already be in your PATH if you installed Rust via rustup.

Note: If you make changes to the code, reinstall with:

cargo install --path . --force

Usage

The CLI provides an entity command that creates a new Bevy entity module:

helper entity <name>

Where <name> must be in snake_case format (e.g., player_character, enemy_spawner, health_pickup).

Example

helper entity player_character

This will create a directory structure like:

player_character/
├── mod.rs
├── components.rs
└── systems.rs

What It Does

When you run helper entity <name>, the tool:

  1. Creates a subdirectory with the entity name in the current directory
  2. Generates three files in that subdirectory:
    • mod.rs - Contains the plugin structure with a [Name]Plugin (converted from snake_case to PascalCase)
    • components.rs - Template file for entity components
    • systems.rs - Template file for entity systems
  3. Updates parent mod.rs - If a mod.rs file exists in the current directory, it automatically adds mod <name>; at the top

Generated File Contents

mod.rs

use bevy::prelude::*;

use systems::*;

use components::*;

pub mod components;

mod systems;

pub struct [NameToPascalCase]Plugin;

impl Plugin for [NameToPascalCase]Plugin {
    fn build(&self, app: &mut App) {
    }
}

components.rs

// Components related to [NameToPascalCase]

use super::*;

systems.rs

// Systems for [NameToPascalCase]

use super::*;

Where [NameToPascalCase] is automatically converted from the snake_case input (e.g., player_characterPlayerCharacter).

Requirements

  • Rust (installed via rustup recommended)
  • The clap crate (automatically installed as a dependency)

About

Auto generate entities

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages