#query-string #command-line-arguments #bevy #bevy-plugin #args #query-parameters #parse-url

bevy_args

bevy plugin to parse command line arguments and URL query parameters

7 stable releases

new 1.4.2 May 15, 2024
1.3.0 Feb 18, 2024
1.2.0 Jan 26, 2024
1.1.0 Jan 26, 2024
1.0.0 Jan 15, 2024

#705 in Game dev

Download history 37/week @ 2024-01-24 1/week @ 2024-02-07 179/week @ 2024-02-14 90/week @ 2024-02-21 29/week @ 2024-02-28 49/week @ 2024-03-06 24/week @ 2024-03-13 9/week @ 2024-03-20 24/week @ 2024-03-27 26/week @ 2024-04-03 1/week @ 2024-04-10 13/week @ 2024-04-17 21/week @ 2024-04-24 22/week @ 2024-05-01

57 downloads per month
Used in 5 crates

MIT license

15KB
86 lines

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

URL query parameters

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

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.3 0.13
1.0 0.12

Dependencies

~24–55MB
~881K SLoC