summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs15
1 files changed, 9 insertions, 6 deletions
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};
2use modlist::{ 2use modlist::{
3 config::Cfg, 3 config::Cfg,
4 db::{config_get_current_list, lists_get, lists_get_all_ids}, 4 db::{config_get_current_list, lists_get, lists_get_all_ids},
5 devdir, download, export, get_current_list, import, list_add, list_change, list_remove, 5 download, export, get_current_list, import, list_add, list_change, list_remove,
6 list_version, mod_add, mod_remove, update, IDSelector, List, Modloader, 6 list_version, mod_add, mod_remove, update, IDSelector, List, Modloader,
7}; 7};
8 8
@@ -14,6 +14,10 @@ use modlist::{
14struct Cli { 14struct Cli {
15 #[command(subcommand)] 15 #[command(subcommand)]
16 command: Commands, 16 command: Commands,
17
18 /// config file path
19 #[arg(short, long)]
20 config: Option<String>,
17} 21}
18 22
19#[derive(Subcommand)] 23#[derive(Subcommand)]
@@ -142,8 +146,8 @@ enum ListCommands {
142#[tokio::main] 146#[tokio::main]
143async fn main() { 147async fn main() {
144 let cli = Cli::parse(); 148 let cli = Cli::parse();
145 149
146 let config = Cfg::init("modlist.toml").unwrap(); 150 let config = Cfg::init(cli.config).unwrap();
147 println!("{:?}", config); 151 println!("{:?}", config);
148 152
149 //TODO setup? maybe setup on install 153 //TODO setup? maybe setup on install
@@ -250,15 +254,14 @@ async fn main() {
250 Commands::Import { file, download } => { 254 Commands::Import { file, download } => {
251 let filestr: String = match file { 255 let filestr: String = match file {
252 Some(args) => args, 256 Some(args) => args,
253 None => devdir( 257 None =>
254 dirs::home_dir() 258 dirs::home_dir()
255 .unwrap() 259 .unwrap()
256 .join("mlexport.toml") 260 .join("mlexport.toml")
257 .into_os_string() 261 .into_os_string()
258 .into_string() 262 .into_string()
259 .unwrap() 263 .unwrap()
260 .as_str(), 264 ,
261 ),
262 }; 265 };
263 266
264 import(config, filestr, download).await 267 import(config, filestr, download).await