diff --git a/bin/src/commands/dev.rs b/bin/src/commands/dev.rs index 275f9442..01cd1fa1 100644 --- a/bin/src/commands/dev.rs +++ b/bin/src/commands/dev.rs @@ -37,6 +37,9 @@ pub struct Command { #[clap(flatten)] pub(crate) dev: DevArgs, + #[clap(flatten)] + pub(crate) binarize: BinarizeArgs, + #[clap(flatten)] pub(crate) just: JustArgs, @@ -47,12 +50,6 @@ pub struct Command { #[derive(clap::Args)] #[allow(clippy::module_name_repetitions)] pub struct DevArgs { - #[arg(long, short, action = clap::ArgAction::SetTrue, verbatim_doc_comment)] - /// Use BI's binarize on supported files - /// - /// By default, `hemtt dev` will not binarize any files, but rather pack them as-is. - /// Binarization is often not needed for development. - pub(crate) binarize: bool, #[arg(long, short, action = clap::ArgAction::Append, verbatim_doc_comment)] /// Include an optional addon folder /// @@ -72,12 +69,29 @@ pub struct DevArgs { pub(crate) no_rap: bool, } +#[derive(Clone, clap::Args)] +pub struct BinarizeArgs { + #[arg(long, short, action = clap::ArgAction::SetTrue, verbatim_doc_comment)] + /// Use BI's binarize on supported files + /// + /// By default, `hemtt dev` will not binarize any files, but rather pack them as-is. + /// Binarization is often not needed for development. + pub(crate) binarize: bool, +} + /// Execute the dev command /// /// # Errors /// [`Error`] depending on the modules pub fn execute(cmd: &Command, launch_optionals: &[String]) -> Result<(Report, Context), Error> { - let mut executor = context(&cmd.dev, &cmd.just, launch_optionals, false, true)?; + let mut executor = context( + &cmd.dev, + &cmd.binarize, + &cmd.just, + launch_optionals, + false, + true, + )?; executor.run().map(|r| (r, executor.into_ctx())) } @@ -87,6 +101,7 @@ pub fn execute(cmd: &Command, launch_optionals: &[String]) -> Result<(Report, Co /// [`Error`] depending on the modules pub fn context( dev: &DevArgs, + binarize: &BinarizeArgs, just: &JustArgs, launch_optionals: &[String], force_binarize: bool, @@ -153,7 +168,7 @@ pub fn context( } executor.add_module(Box::::default()); executor.add_module(Box::::default()); - if force_binarize || dev.binarize { + if force_binarize || binarize.binarize { executor.add_module(Box::::default()); } diff --git a/bin/src/commands/launch/mod.rs b/bin/src/commands/launch/mod.rs index 30abe860..35d10f99 100644 --- a/bin/src/commands/launch/mod.rs +++ b/bin/src/commands/launch/mod.rs @@ -178,6 +178,9 @@ pub struct Command { #[clap(flatten)] dev: super::dev::DevArgs, + #[clap(flatten)] + binarize: super::dev::BinarizeArgs, + #[clap(flatten)] just: super::JustArgs, @@ -287,6 +290,7 @@ pub fn execute(cmd: &Command) -> Result { } else { let mut executor = super::dev::context( &cmd.dev, + &cmd.binarize, &cmd.just, launch.optionals(), launch.binarize(), diff --git a/bin/src/commands/photoshoot/mod.rs b/bin/src/commands/photoshoot/mod.rs index f3bf4636..295f8e69 100644 --- a/bin/src/commands/photoshoot/mod.rs +++ b/bin/src/commands/photoshoot/mod.rs @@ -43,6 +43,9 @@ pub struct Command { /// - `.hemtt/launch.toml` config: Option>, + #[clap(flatten)] + binarize: dev::BinarizeArgs, + #[clap(flatten)] global: crate::GlobalArgs, } @@ -100,9 +103,9 @@ pub fn execute(cmd: &Command) -> Result { dev: dev::DevArgs { optional: Vec::new(), all_optionals: true, - binarize: false, no_rap: false, }, + binarize: cmd.binarize.clone(), just: JustArgs { just: Vec::new() }, }, launch.optionals(),