diff options
-rw-r--r-- | Cargo.lock | 2 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | data.db | bin | 24576 -> 24576 bytes | |||
-rw-r--r-- | planmodlist.xopp | bin | 243533 -> 227774 bytes | |||
-rw-r--r-- | src/commands/list.rs | 12 |
5 files changed, 9 insertions, 7 deletions
@@ -647,7 +647,7 @@ dependencies = [ | |||
647 | 647 | ||
648 | [[package]] | 648 | [[package]] |
649 | name = "modlist" | 649 | name = "modlist" |
650 | version = "0.5.2" | 650 | version = "0.6.0" |
651 | dependencies = [ | 651 | dependencies = [ |
652 | "chrono", | 652 | "chrono", |
653 | "config", | 653 | "config", |
@@ -1,6 +1,6 @@ | |||
1 | [package] | 1 | [package] |
2 | name = "modlist" | 2 | name = "modlist" |
3 | version = "0.6.0" | 3 | version = "0.6.1" |
4 | edition = "2021" | 4 | edition = "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 |
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 | ||
51 | fn change(config: Cfg, args: Vec<String>) -> Result<(), Box<dyn std::error::Error>> { | 51 | fn 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 | ||