Add cond compile for some command line arguments

This commit is contained in:
2025-06-05 07:52:57 +08:00
parent d28a604e34
commit 8083990e94
3 changed files with 8 additions and 0 deletions

View File

@@ -57,6 +57,7 @@ pub struct Arg {
)]
/// Archive code page
pub archive_code_page: Option<u32>,
#[cfg(feature = "circus")]
#[arg(long, value_enum, global = true)]
/// Circus Game
pub circus_mes_type: Option<CircusMesType>,
@@ -66,6 +67,7 @@ pub struct Arg {
#[arg(global = true, action = ArgAction::SetTrue, short, long)]
/// Print backtrace on error
pub backtrace: bool,
#[cfg(feature = "escude-arc")]
#[arg(long, action = ArgAction::SetTrue, global = true)]
/// Whether to use fake compression for Escude archive
pub escude_fake_compress: bool,

View File

@@ -985,7 +985,9 @@ fn main() {
unsafe { std::env::set_var("RUST_LIB_BACKTRACE", "1") };
}
let cfg = types::ExtraConfig {
#[cfg(feature = "circus")]
circus_mes_type: arg.circus_mes_type.clone(),
#[cfg(feature = "escude-arc")]
escude_fake_compress: arg.escude_fake_compress.clone(),
};
match &arg.command {

View File

@@ -80,6 +80,7 @@ impl AsRef<str> for OutputScriptType {
}
}
#[cfg(feature = "circus")]
#[derive(Clone, Copy, Debug, ValueEnum, PartialEq, Eq, PartialOrd, Ord)]
pub enum CircusMesType {
/// fortissimo//Akkord:Bsusvier
@@ -146,6 +147,7 @@ pub enum CircusMesType {
Nightshade,
}
#[cfg(feature = "circus")]
impl AsRef<str> for CircusMesType {
fn as_ref(&self) -> &str {
match self {
@@ -185,7 +187,9 @@ impl AsRef<str> for CircusMesType {
}
pub struct ExtraConfig {
#[cfg(feature = "circus")]
pub circus_mes_type: Option<CircusMesType>,
#[cfg(feature = "escude-arc")]
pub escude_fake_compress: bool,
}