summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfxqnlr <[email protected]>2023-01-11 17:31:17 +0100
committerfxqnlr <[email protected]>2023-01-11 17:31:17 +0100
commitfad32c31b59001bed46fa860fbc3a994d278e700 (patch)
tree4793c6bdd3429275463bd9c75ce0648b9733fd85 /src
parent92bda65a9983e60036b3d49333e9bfe9bcd0543f (diff)
downloadmodlist-fad32c31b59001bed46fa860fbc3a994d278e700.tar
modlist-fad32c31b59001bed46fa860fbc3a994d278e700.tar.gz
modlist-fad32c31b59001bed46fa860fbc3a994d278e700.zip
cargo update, minor error impls
Diffstat (limited to 'src')
-rw-r--r--src/commands/list.rs9
-rw-r--r--src/db.rs2
2 files changed, 7 insertions, 4 deletions
diff --git a/src/commands/list.rs b/src/commands/list.rs
index a02f8b1..3998cce 100644
--- a/src/commands/list.rs
+++ b/src/commands/list.rs
@@ -23,7 +23,10 @@ pub async fn list(config: Cfg, input: Input) -> Result<(), Box<dyn std::error::E
23 change(config, input.args) 23 change(config, input.args)
24 }, 24 },
25 Subcmd::Remove => { 25 Subcmd::Remove => {
26 remove(config, input.args.ok_or("")?) 26 match remove(config, input.args.ok_or("")?) {
27 Ok(..) => Ok(()),
28 Err(e) => Err(Box::new(e))
29 }
27 }, 30 },
28 Subcmd::Version => { 31 Subcmd::Version => {
29 match version(config, Some(input.args.ok_or("NO_VERSION")?), Some(MCVersionType::Release)).await { 32 match version(config, Some(input.args.ok_or("NO_VERSION")?), Some(MCVersionType::Release)).await {
@@ -72,10 +75,10 @@ fn change(config: Cfg, args: Option<Vec<String>>) -> Result<(), Box<dyn std::err
72 } 75 }
73} 76}
74 77
75fn remove(config: Cfg, args: Vec<String>) -> Result<(), Box<dyn std::error::Error>> { 78fn remove(config: Cfg, args: Vec<String>) -> MLE<()> {
76 match args.len() { 79 match args.len() {
77 1 => lists_remove(config, String::from(&args[0])), 80 1 => lists_remove(config, String::from(&args[0])),
78 2.. => Err(Box::new(Error::new(ErrorKind::InvalidInput, "TOO_MANY_ARGUMENTS"))), 81 2.. => Err(MLError::new(ErrorType::ArgumentCountError, "TOO_MANY_ARGUMENTS")),
79 _ => panic!("list arguments should never be zero or lower"), 82 _ => panic!("list arguments should never be zero or lower"),
80 } 83 }
81} 84}
diff --git a/src/db.rs b/src/db.rs
index c5a972f..06c2459 100644
--- a/src/db.rs
+++ b/src/db.rs
@@ -361,7 +361,7 @@ pub fn lists_insert(config: Cfg, id: String, mc_version: String, mod_loader: Mod
361 Ok(()) 361 Ok(())
362} 362}
363 363
364pub fn lists_remove(config: Cfg, id: String) -> Result<(), Box<dyn std::error::Error>> { 364pub fn lists_remove(config: Cfg, id: String) -> MLE<()> {
365 let data = devdir(format!("{}/data.db", config.data).as_str()); 365 let data = devdir(format!("{}/data.db", config.data).as_str());
366 let connection = Connection::open(data)?; 366 let connection = Connection::open(data)?;
367 367