summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml2
-rw-r--r--data.dbbin24576 -> 24576 bytes
-rw-r--r--planmodlist.xoppbin243533 -> 227774 bytes
-rw-r--r--src/commands/list.rs12
5 files changed, 9 insertions, 7 deletions
diff --git a/Cargo.lock b/Cargo.lock
index c7738d3..6fb495c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -647,7 +647,7 @@ dependencies = [
647 647
648[[package]] 648[[package]]
649name = "modlist" 649name = "modlist"
650version = "0.5.2" 650version = "0.6.0"
651dependencies = [ 651dependencies = [
652 "chrono", 652 "chrono",
653 "config", 653 "config",
diff --git a/Cargo.toml b/Cargo.toml
index a881bfc..13280a1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
1[package] 1[package]
2name = "modlist" 2name = "modlist"
3version = "0.6.0" 3version = "0.6.1"
4edition = "2021" 4edition = "2021"
5 5
6# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 6# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
diff --git a/data.db b/data.db
index b9aacd5..322caab 100644
--- a/data.db
+++ b/data.db
Binary files differ
diff --git a/planmodlist.xopp b/planmodlist.xopp
index 30007d4..ef99663 100644
--- a/planmodlist.xopp
+++ b/planmodlist.xopp
Binary files differ
diff --git a/src/commands/list.rs b/src/commands/list.rs
index 096ce65..bc9e67e 100644
--- a/src/commands/list.rs
+++ b/src/commands/list.rs
@@ -17,7 +17,7 @@ pub fn list(config: Cfg, input: Input) -> Result<(), Box<dyn std::error::Error>>
17 add(config, input.args.ok_or("")?) 17 add(config, input.args.ok_or("")?)
18 }, 18 },
19 Subcmd::Change => { 19 Subcmd::Change => {
20 change(config, input.args.ok_or("")?) 20 change(config, input.args)
21 }, 21 },
22 Subcmd::Remove => { 22 Subcmd::Remove => {
23 remove(config, input.args.ok_or("")?) 23 remove(config, input.args.ok_or("")?)
@@ -48,16 +48,18 @@ fn add(config: Cfg, args: Vec<String>) -> Result<(), Box<dyn std::error::Error>>
48 } 48 }
49} 49}
50 50
51fn change(config: Cfg, args: Vec<String>) -> Result<(), Box<dyn std::error::Error>> { 51fn change(config: Cfg, args: Option<Vec<String>>) -> Result<(), Box<dyn std::error::Error>> {
52 let lists = lists_get_all_ids(config.clone())?; 52 let lists = lists_get_all_ids(config.clone())?;
53 match args.len() { 53 if args.is_none() { println!("Currently selected list: {}", get_current_list(config)?.id); return Ok(()) };
54 let argsvec = args.ok_or("BAH")?;
55 match argsvec.len() {
54 1 => { 56 1 => {
55 let list = String::from(&args[0]); 57 let list = String::from(&argsvec[0]);
56 if !lists.contains(&list) { return Err(Box::new(Error::new(ErrorKind::NotFound, "LIST_DOESNT_EXIST"))); }; 58 if !lists.contains(&list) { return Err(Box::new(Error::new(ErrorKind::NotFound, "LIST_DOESNT_EXIST"))); };
57 config_change_current_list(config, list) 59 config_change_current_list(config, list)
58 }, 60 },
59 2.. => Err(Box::new(Error::new(ErrorKind::InvalidInput, "TOO_MANY_ARGUMENTS"))), 61 2.. => Err(Box::new(Error::new(ErrorKind::InvalidInput, "TOO_MANY_ARGUMENTS"))),
60 _ => panic!("list arguments should never be zero or lower"), 62 _ => panic!("list arguments should never lower than zero"),
61 } 63 }
62} 64}
63 65