From 3e65975227baa511f570e8223fccda5607cf905e Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Sun, 23 Apr 2023 21:47:37 +0200 Subject: added config argument, remove devdir --- src/main.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 2006856..957e7c9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,7 @@ use clap::{Parser, Subcommand}; use modlist::{ config::Cfg, db::{config_get_current_list, lists_get, lists_get_all_ids}, - devdir, download, export, get_current_list, import, list_add, list_change, list_remove, + download, export, get_current_list, import, list_add, list_change, list_remove, list_version, mod_add, mod_remove, update, IDSelector, List, Modloader, }; @@ -14,6 +14,10 @@ use modlist::{ struct Cli { #[command(subcommand)] command: Commands, + + /// config file path + #[arg(short, long)] + config: Option, } #[derive(Subcommand)] @@ -142,8 +146,8 @@ enum ListCommands { #[tokio::main] async fn main() { let cli = Cli::parse(); - - let config = Cfg::init("modlist.toml").unwrap(); + + let config = Cfg::init(cli.config).unwrap(); println!("{:?}", config); //TODO setup? maybe setup on install @@ -250,15 +254,14 @@ async fn main() { Commands::Import { file, download } => { let filestr: String = match file { Some(args) => args, - None => devdir( + None => dirs::home_dir() .unwrap() .join("mlexport.toml") .into_os_string() .into_string() .unwrap() - .as_str(), - ), + , }; import(config, filestr, download).await -- cgit v1.2.3