Crates.io | bevy_args |
lib.rs | bevy_args |
version | 1.5.0 |
source | src |
created_at | 2024-01-15 09:16:07.606211 |
updated_at | 2024-07-06 19:57:41.325511 |
description | bevy plugin to parse command line arguments and URL query parameters |
homepage | https://github.com/mosure/bevy_args |
repository | https://github.com/mosure/bevy_args |
max_upload_size | |
id | 1100182 |
size | 47,834 |
bevy plugin to parse command line arguments and URL query parameters into resources
cargo run --example=minimal -- --my-string hello --my-int 42 --my-bool
http://localhost:8080/?my_string=hello&my_int=42&my_bool=true
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);
}
bevy_args |
bevy |
---|---|
1.5 |
0.14 |
1.3 |
0.13 |
1.0 |
0.12 |