summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorfx <[email protected]>2023-04-27 10:10:03 +0200
committerfx <[email protected]>2023-04-27 10:10:03 +0200
commit43ca5fec20933fc31dfe7d7dbd1f1b9258612219 (patch)
treeeef58fecfadad90386b38af581abab8cc3d3cfc0 /src/main.rs
parent4300ad2eb05dddfa4274e04b204f2ad28c87da05 (diff)
parent4e6466af1329f7b9e341df2e76ab696d11f80c93 (diff)
downloadmodlist-43ca5fec20933fc31dfe7d7dbd1f1b9258612219.tar
modlist-43ca5fec20933fc31dfe7d7dbd1f1b9258612219.tar.gz
modlist-43ca5fec20933fc31dfe7d7dbd1f1b9258612219.zip
Merge pull request 'cache' (#3) from cache into master
Reviewed-on: http://raspberrypi.fritz.box:7920/fx/modlist/pulls/3
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs26
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};
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, 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::{
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)]
@@ -143,10 +147,9 @@ enum ListCommands {
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
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