Skip to content

Passing Arguments to the underlying Bevy app does not work for bevy run web #711

@DaAlbrecht

Description

@DaAlbrecht

Its currently not possible to pass additional arguments to the bevy app when using the web subcommand. This is because:

#[derive(Debug, Args, Clone)]
pub struct RunArgs {
    /// The subcommands available for the run command.
    #[command(subcommand)]
    pub subcommand: Option<RunSubcommands>,

    /// Confirm all prompts automatically.
    #[arg(long = "yes", default_value_t = false)]
    pub confirm_prompts: bool,

    /// Commands to forward to `cargo run`.
    #[clap(flatten)]
    pub cargo_args: CargoRunArgs,

    /// Arguments to pass to the underlying Bevy app.
    ///
    /// Specified after `--`.
    #[clap(last = true, name = "ARGS")]
    pub forward_args: Vec<String>,
}

Results in the following: Usage: bevy run [OPTIONS] [-- <ARGS>...] [COMMAND]

But: bevy run -- --foo web will result in cargo run --profile dev -- --mute web.

See also: https://docs.rs/clap/latest/clap/struct.Arg.html#method.last

WARNING: Using this setting and having child subcommands is not recommended with the exception of also using crate::Command::args_conflicts_with_subcommands (or crate::Command::subcommand_negates_reqs if the argument marked Last is also marked Arg::required)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RunRelated to the bevy run commandA-WebBuilding or running Bevy apps targeting the browserC-BugA bug in the program

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions