bevy_args

Crates.iobevy_args
lib.rsbevy_args
version
sourcesrc
created_at2024-01-15 09:16:07.606211
updated_at2024-11-30 17:19:39.650934
descriptionbevy plugin to parse command line arguments and URL query parameters
homepagehttps://github.com/mosure/bevy_args
repositoryhttps://github.com/mosure/bevy_args
max_upload_size
id1100182
Cargo.toml error:TOML parse error at line 27, column 1 | 27 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Mitchell Mosure (mosure)

documentation

README

bevy_args 🧩

test GitHub License GitHub Last Commit GitHub Releases GitHub Issues Average time to resolve an issue crates.io

bevy plugin to parse command line arguments and URL query parameters into resources

command line arguments

cargo run --example=minimal -- --my-string hello --my-int 42 --my-bool --my-enum another-value

URL query parameters

http://localhost:8080/?my_string=hello&my_int=42&my_bool=true&my_enum=AnotherValue

minimal example

use bevy_args::BevyArgsPlugin;


#[derive(
    Default,
    Debug,
    Resource,
    Serialize,
    Deserialize,
    Parser,
)]
#[command(about = "a minimal example of bevy_args", version, long_about = None)]
pub struct MinimalArgs {
    #[arg(long, default_value = "hello")]
    pub my_string: String,

    #[arg(long, default_value = "42")]
    pub my_int: i32,

    #[arg(long)]
    pub my_bool: bool,
}


pub fn main() {
    let mut app = App::new();

    app.add_plugins(BevyArgsPlugin::<MinimalArgs>::default());
    app.add_systems(Startup, print_minimal_args);

    app.run();
}

fn print_minimal_args(args: Res<MinimalArgs>) {
    println!("{:?}", *args);
}

compatible bevy versions

bevy_args bevy
1.7 0.15
1.5 0.14
1.3 0.13
1.0 0.12
Commit count: 22

cargo fmt