diff options
author | fxqnlr <[email protected]> | 2023-04-17 20:30:16 +0200 |
---|---|---|
committer | fxqnlr <[email protected]> | 2023-04-17 20:30:16 +0200 |
commit | 93e61a4bd6ad8b5db1083bdd21994bf73b0b90ba (patch) | |
tree | 043adeff1c117f3f0e4fe7bffc472c299e01d642 /src/db.rs | |
parent | 77d2ac94534b12300b5b7eff6e28023d815708eb (diff) | |
download | modlist-93e61a4bd6ad8b5db1083bdd21994bf73b0b90ba.tar modlist-93e61a4bd6ad8b5db1083bdd21994bf73b0b90ba.tar.gz modlist-93e61a4bd6ad8b5db1083bdd21994bf73b0b90ba.zip |
added clap cli, modified (basically) all user interface functions;
changed some functions to easier string handling
Diffstat (limited to 'src/db.rs')
-rw-r--r-- | src/db.rs | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -49,6 +49,9 @@ pub fn mods_get_all_ids(config: Cfg) -> Result<Vec<String>, Box<dyn std::error:: | |||
49 | /// | 49 | /// |
50 | ///Will return `MLError` when no mod id is found | 50 | ///Will return `MLError` when no mod id is found |
51 | pub fn mods_get_id(data: &str, slug: &str) -> MLE<String> { | 51 | pub fn mods_get_id(data: &str, slug: &str) -> MLE<String> { |
52 | |||
53 | //TODO check if "slug" is id | ||
54 | |||
52 | let data = devdir(format!("{}/data.db", data).as_str()); | 55 | let data = devdir(format!("{}/data.db", data).as_str()); |
53 | let connection = Connection::open(data)?; | 56 | let connection = Connection::open(data)?; |
54 | 57 | ||
@@ -192,8 +195,7 @@ pub fn userlist_get_all_ids(config: Cfg, list_id: String) -> MLE<Vec<String>> { | |||
192 | } | 195 | } |
193 | } | 196 | } |
194 | 197 | ||
195 | 198 | pub fn userlist_remove(config: Cfg, list_id: &str, mod_id: &str) -> MLE<()> { | |
196 | pub fn userlist_remove(config: Cfg, list_id: String, mod_id: String) -> MLE<()> { | ||
197 | let data = devdir(format!("{}/data.db", config.data).as_str()); | 199 | let data = devdir(format!("{}/data.db", config.data).as_str()); |
198 | let connection = Connection::open(data)?; | 200 | let connection = Connection::open(data)?; |
199 | 201 | ||
@@ -242,7 +244,7 @@ pub fn userlist_get_all_applicable_versions_with_mods(config: Cfg, list_id: Stri | |||
242 | Ok(versions) | 244 | Ok(versions) |
243 | } | 245 | } |
244 | 246 | ||
245 | pub fn userlist_get_current_version(config: Cfg, list_id: String, mod_id: String) -> MLE<String> { | 247 | pub fn userlist_get_current_version(config: Cfg, list_id: &str, mod_id: &str) -> MLE<String> { |
246 | let data = devdir(format!("{}/data.db", config.data).as_str()); | 248 | let data = devdir(format!("{}/data.db", config.data).as_str()); |
247 | let connection = Connection::open(data).unwrap(); | 249 | let connection = Connection::open(data).unwrap(); |
248 | 250 | ||
@@ -425,7 +427,7 @@ pub fn lists_get(config: Cfg, list_id: String) -> MLE<List> { | |||
425 | Ok(list) | 427 | Ok(list) |
426 | } | 428 | } |
427 | 429 | ||
428 | pub fn lists_version(config: Cfg, list_id: String, version: String) -> MLE<()> { | 430 | pub fn lists_version(config: Cfg, list_id: &str, version: &str) -> MLE<()> { |
429 | let data = devdir(format!("{}/data.db", config.data).as_str()); | 431 | let data = devdir(format!("{}/data.db", config.data).as_str()); |
430 | let connection = Connection::open(data).unwrap(); | 432 | let connection = Connection::open(data).unwrap(); |
431 | 433 | ||