diff options
author | fxqnlr <[email protected]> | 2024-09-04 09:56:42 +0200 |
---|---|---|
committer | fxqnlr <[email protected]> | 2024-09-04 09:56:42 +0200 |
commit | f5e070cdf6628a5ebd981d373929802317104e24 (patch) | |
tree | e31c88371737e20b2cc79bf9ee0c1dbfdeb6e727 /src/commands/list.rs | |
parent | 1d64516ed95266a4fc1f8a18652f99158a4004f1 (diff) | |
download | modlist-f5e070cdf6628a5ebd981d373929802317104e24.tar modlist-f5e070cdf6628a5ebd981d373929802317104e24.tar.gz modlist-f5e070cdf6628a5ebd981d373929802317104e24.zip |
clippy --fix
Diffstat (limited to 'src/commands/list.rs')
-rw-r--r-- | src/commands/list.rs | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/commands/list.rs b/src/commands/list.rs index 3665446..63105cf 100644 --- a/src/commands/list.rs +++ b/src/commands/list.rs | |||
@@ -32,32 +32,32 @@ pub fn list_add( | |||
32 | ) -> MLE<()> { | 32 | ) -> MLE<()> { |
33 | let p = ProgressBar::new_spinner(); | 33 | let p = ProgressBar::new_spinner(); |
34 | p.set_style(ProgressStyle::with_template(STYLE_OPERATION).unwrap()); | 34 | p.set_style(ProgressStyle::with_template(STYLE_OPERATION).unwrap()); |
35 | p.set_message(format!("Create {}", id)); | 35 | p.set_message(format!("Create {id}")); |
36 | lists_insert(config, id, mc_version, modloader, directory)?; | 36 | lists_insert(config, id, mc_version, modloader, directory)?; |
37 | p.finish_with_message(format!("Created {}", id)); | 37 | p.finish_with_message(format!("Created {id}")); |
38 | Ok(()) | 38 | Ok(()) |
39 | } | 39 | } |
40 | 40 | ||
41 | pub fn list_change(config: &Cfg, id: &str) -> MLE<()> { | 41 | pub fn list_change(config: &Cfg, id: &str) -> MLE<()> { |
42 | let p = ProgressBar::new_spinner(); | 42 | let p = ProgressBar::new_spinner(); |
43 | p.set_style(ProgressStyle::with_template(STYLE_OPERATION).unwrap()); | 43 | p.set_style(ProgressStyle::with_template(STYLE_OPERATION).unwrap()); |
44 | p.set_message(format!("Change default list to {}", id)); | 44 | p.set_message(format!("Change default list to {id}")); |
45 | 45 | ||
46 | if !lists_get_all_ids(config)?.into_iter().any(|l| l == id) { | 46 | if !lists_get_all_ids(config)?.into_iter().any(|l| l == id) { |
47 | return Err(MLError::new(ErrorType::ArgumentError, "List not found")); | 47 | return Err(MLError::new(ErrorType::ArgumentError, "List not found")); |
48 | }; | 48 | }; |
49 | config_change_current_list(config, id)?; | 49 | config_change_current_list(config, id)?; |
50 | 50 | ||
51 | p.finish_with_message(format!("Changed default list to {}", id)); | 51 | p.finish_with_message(format!("Changed default list to {id}")); |
52 | Ok(()) | 52 | Ok(()) |
53 | } | 53 | } |
54 | 54 | ||
55 | pub fn list_remove(config: &Cfg, id: &str) -> MLE<()> { | 55 | pub fn list_remove(config: &Cfg, id: &str) -> MLE<()> { |
56 | let p = ProgressBar::new_spinner(); | 56 | let p = ProgressBar::new_spinner(); |
57 | p.set_style(ProgressStyle::with_template(STYLE_OPERATION).unwrap()); | 57 | p.set_style(ProgressStyle::with_template(STYLE_OPERATION).unwrap()); |
58 | p.set_message(format!("Remove {}", id)); | 58 | p.set_message(format!("Remove {id}")); |
59 | lists_remove(config, id)?; | 59 | lists_remove(config, id)?; |
60 | p.finish_with_message(format!("Removed {}", id)); | 60 | p.finish_with_message(format!("Removed {id}")); |
61 | Ok(()) | 61 | Ok(()) |
62 | } | 62 | } |
63 | 63 | ||
@@ -77,15 +77,13 @@ pub async fn list_version( | |||
77 | let p = ProgressBar::new_spinner(); | 77 | let p = ProgressBar::new_spinner(); |
78 | p.set_style(ProgressStyle::with_template(STYLE_OPERATION).unwrap()); | 78 | p.set_style(ProgressStyle::with_template(STYLE_OPERATION).unwrap()); |
79 | p.set_message(format!( | 79 | p.set_message(format!( |
80 | "Change version for list {} to minecraft version: {}", | 80 | "Change version for list {id} to minecraft version: {mc_version}" |
81 | id, mc_version | ||
82 | )); | 81 | )); |
83 | 82 | ||
84 | lists_version(config, id, &mc_version)?; | 83 | lists_version(config, id, &mc_version)?; |
85 | 84 | ||
86 | p.finish_with_message(format!( | 85 | p.finish_with_message(format!( |
87 | "Changed version for list {} to minecraft version: {}", | 86 | "Changed version for list {id} to minecraft version: {mc_version}" |
88 | id, mc_version | ||
89 | )); | 87 | )); |
90 | 88 | ||
91 | let list = lists_get(config, id)?; | 89 | let list = lists_get(config, id)?; |
@@ -96,7 +94,7 @@ pub fn list_list(config: &Cfg) -> MLE<()> { | |||
96 | let lists = lists_get_all_ids(config)?; | 94 | let lists = lists_get_all_ids(config)?; |
97 | for list in lists { | 95 | for list in lists { |
98 | let l = lists_get(config, &list)?; | 96 | let l = lists_get(config, &list)?; |
99 | println!("{}: | {} | {}", l.id, l.mc_version, l.modloader) | 97 | println!("{}: | {} | {}", l.id, l.mc_version, l.modloader); |
100 | } | 98 | } |
101 | Ok(()) | 99 | Ok(()) |
102 | } | 100 | } |