diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/main.rs b/src/main.rs index 2006856..0ecb850 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -2,8 +2,8 @@ use clap::{Parser, Subcommand}; | |||
2 | use modlist::{ | 2 | use 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, list_version, |
6 | list_version, mod_add, mod_remove, update, IDSelector, List, Modloader, | 6 | mod_add, mod_remove, update, IDSelector, List, Modloader, |
7 | }; | 7 | }; |
8 | 8 | ||
9 | //TODO implement remote sql db | 9 | //TODO implement remote sql db |
@@ -14,6 +14,10 @@ use modlist::{ | |||
14 | struct Cli { | 14 | struct 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)] |
@@ -143,10 +147,9 @@ enum ListCommands { | |||
143 | async fn main() { | 147 | async 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 | ||
150 | match cli.command { | 153 | match cli.command { |
151 | Commands::Mod { command } => { | 154 | Commands::Mod { command } => { |
152 | match command { | 155 | match command { |
@@ -250,15 +253,12 @@ async fn main() { | |||
250 | Commands::Import { file, download } => { | 253 | Commands::Import { file, download } => { |
251 | let filestr: String = match file { | 254 | let filestr: String = match file { |
252 | Some(args) => args, | 255 | Some(args) => args, |
253 | None => devdir( | 256 | None => dirs::home_dir() |
254 | dirs::home_dir() | 257 | .unwrap() |
255 | .unwrap() | 258 | .join("mlexport.toml") |
256 | .join("mlexport.toml") | 259 | .into_os_string() |
257 | .into_os_string() | 260 | .into_string() |
258 | .into_string() | 261 | .unwrap(), |
259 | .unwrap() | ||
260 | .as_str(), | ||
261 | ), | ||
262 | }; | 262 | }; |
263 | 263 | ||
264 | import(config, filestr, download).await | 264 | import(config, filestr, download).await |