Skip to content

Commit

Permalink
Merge pull request #29 from podcherklife/alt-parsing
Browse files Browse the repository at this point in the history
Alt parsing
  • Loading branch information
dark0dave authored Nov 18, 2023
2 parents 10c2252 + 85d66d8 commit 1db0894
Show file tree
Hide file tree
Showing 3 changed files with 277 additions and 92 deletions.
3 changes: 3 additions & 0 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ pub struct Args {
/// Compare against installed weidu log, note this is best effort
#[clap(long, short, action=ArgAction::SetTrue)]
pub skip_installed: bool,

#[clap(long, action=ArgAction::SetTrue)]
pub stop_on_warnings: bool,
}

fn parse_absolute_path(arg: &str) -> Result<PathBuf, String> {
Expand Down
26 changes: 22 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{
copy_mod_folder, create_weidu_log_if_not_exists, mod_folder_present_in_game_directory,
search_mod_folders,
},
weidu::install,
weidu::{install, InstallationResult},
};

mod args;
Expand Down Expand Up @@ -73,12 +73,30 @@ fn main() {
);
copy_mod_folder(&args.game_directory, mod_folder)
}
install(
log::info!("Installing mod {:?}", &weidu_mod);
match install(
&args.weidu_binary,
&args.game_directory,
&weidu_mod,
&args.language,
);
log::info!("Installed mod {:?}", &weidu_mod);
) {
InstallationResult::Fail(message) => {
panic!(
"Failed to install mod {}, error is '{}'",
weidu_mod.name, message
);
}
InstallationResult::Success => {
log::info!("Installed mod {:?}", &weidu_mod);
}
InstallationResult::Warnings => {
if args.stop_on_warnings {
log::info!("Installed mod {:?} with warnings, stopping", &weidu_mod);
break;
} else {
log::info!("Installed mod {:?} with warnings, keep going", &weidu_mod);
}
}
}
}
}
Loading

0 comments on commit 1db0894

Please sign in to comment.