use std::{env, process}; use modlist::{config::Cfg, input::{get_input, Cmd}, update, download, list, io}; #[tokio::main] async fn main() { let config = Cfg::init("modlist.toml").unwrap(); let mut args: Vec = env::args().collect(); args.reverse(); args.pop(); args.reverse(); let input = match get_input(config.clone(), args).await { Ok(i) => i, Err(e) => { println!("{}", e); process::exit(1); } }; //dbg!(&input); match input.clone().command.unwrap() { Cmd::Mod => { Ok(()) }, Cmd::List => { list(config, input).await }, Cmd::Update => { update(config, input).await }, Cmd::Download => { download(config, input).await }, Cmd::Io => { io(config, input).await }, Cmd::Version => { show_version(); Ok(()) }, }.unwrap() } fn show_version() { match std::env::var("DEV") { Ok(dev) => { let devint = dev.parse::().unwrap(); if devint >= 1 { println!("Modlist by FxQnLr v{} (DEV)", env!("CARGO_PKG_VERSION")); } else { println!("Modlist by FxQnLr v{}", env!("CARGO_PKG_VERSION")); } }, Err(..) => println!("Modlist by FxQnLr v{}", env!("CARGO_PKG_VERSION")), } }