fix bugs and make help menu

This commit is contained in:
SadlyNotSappho 2023-08-01 16:04:34 -07:00
parent 67a5061830
commit 3a53cc98bb
2 changed files with 16 additions and 8 deletions

View File

@ -52,7 +52,7 @@ pub fn get_steam_location() -> String {
// linux: ~/.local/share/Steam
match std::env::consts::OS {
"linux" => String::from(format!("{}/.local/share/Steam", get_home())),
"windows" => String::from("C:\\Program Files (x86)\\Steam"),
"windows" => String::from("C:/Program Files (x86)/Steam"),
_ => panic!(
"if ya tell me what OS you're on and where your steam location is, i can fix this"
),
@ -63,7 +63,7 @@ pub fn get_config_location() -> String {
// linux: ~/.config
match std::env::consts::OS {
"linux" => String::from(format!("{}/.config", get_home())),
"windows" => String::from(format!("{}\\AppData\\Roaming", get_home())),
"windows" => String::from(format!("{}/AppData/Roaming", get_home())),
_ => String::from(format!("{}/.config", get_home())),
}
}

View File

@ -7,11 +7,19 @@ fn main() {
let cfg =
cyber_mod_manager::read_config(&format!("{config_location}/CyberModManager/config.json"));
match &env::args().collect::<Vec<String>>()[1][..] {
"deploy" => cyber_mod_manager::deploy(cfg),
"undeploy" => cyber_mod_manager::undeploy(cfg),
"unzip" => cyber_mod_manager::unzip(cfg),
"openfolder" => opener::open(cfg.archives).unwrap(),
_ => panic!("arg not supported")
let args = env::args().collect::<Vec<String>>();
let helpstring = "cybermodmanager, written by sadlynotsappho (https://sadlynotsappho.dev)\n - deploy: deploys the mods to the game folder\n - undeploy: you're smart enough to figure this one out\n - unzip: unzips the archives placed in the archives folder\n - openfolder: opens the archives folder";
if args.len() == 1 {
println!("{helpstring}");
} else if args.len() >= 2 {
match &args[1][..] {
"deploy" => cyber_mod_manager::deploy(cfg),
"undeploy" => cyber_mod_manager::undeploy(cfg),
"unzip" => cyber_mod_manager::unzip(cfg),
"openfolder" => opener::open(cfg.archives).unwrap(),
"help" => println!("{helpstring}"),
"--help" => println!("{helpstring}"),
_ => panic!("arg not supported")
}
}
}