mirror of
https://github.com/lifegpc/msg-tool.git
synced 2026-06-07 05:18:44 +08:00
Add cond compile for some command line arguments
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user