Skip to content

Commit

Permalink
Merge pull request #29 from auyer/fix-manage-apps
Browse files Browse the repository at this point in the history
Fix manage apps feature not working when not selecting the DetectAll option
  • Loading branch information
auyer committed Aug 18, 2024
2 parents 918a0ef + 468973b commit d88a44b
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 63 deletions.
96 changes: 48 additions & 48 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions libprotonup/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ hex = "0.4"
hex-literal = "0.4"
pin-project = "1.1"
reqwest = { version = "0.12", default-features = false, features = [
"rustls-tls",
"stream",
"json",
"rustls-tls",
"stream",
"json",
] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
sha2 = "0.10"
structopt = "0.3"
tokio = { version = "1.38", features = ["macros"] }
tokio = { version = "1.39", features = ["macros"] }
tokio-stream = { version = "0.1", features = ["fs"] }
tokio-tar = "0.3"
tokio-util = "0.7"

[dev-dependencies]
tokio = { version = "1.38", features = ["macros", "rt"] }
tokio = { version = "1.39", features = ["macros", "rt"] }
10 changes: 5 additions & 5 deletions protonup-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ futures-util = "0.3"
libprotonup = { path = "../libprotonup", version = "0.8.2" }
inquire = { version = "0.7", default-features = false, features = ["termion"] }
indicatif = { version = "0.17", features = [
"improved_unicode",
"unicode-segmentation",
"tokio"
"improved_unicode",
"unicode-segmentation",
"tokio",
] }
tempfile = "3.10"
tokio = { version = "1.38", features = ["macros", "rt-multi-thread"] }
tempfile = "3.12"
tokio = { version = "1.39", features = ["macros", "rt-multi-thread"] }
clap = { version = "4.5", features = ["derive"] }
16 changes: 11 additions & 5 deletions protonup-rs/src/manage_apps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,20 @@ fn manage_menu() -> Vec<ManageAppsMenuOptions> {
///
/// The user selects the apps and wine versions to remove
pub(crate) async fn manage_apps_routine() {
let mut apps = vec![];

let choices = manage_menu();

if choices.contains(&ManageAppsMenuOptions::DetectAll) {
apps = apps::APP_INSTALLATIONS_VARIANTS.to_vec();
// default to all apps
let mut selected_apps = apps::APP_INSTALLATIONS_VARIANTS.to_vec();
if !choices.contains(&ManageAppsMenuOptions::DetectAll) {
selected_apps = choices
.iter()
.map(|choice| match choice {
ManageAppsMenuOptions::DetectAll => unreachable!(), // managed by the default case
ManageAppsMenuOptions::AppInstallations(app) => app.to_owned(),
})
.collect::<Vec<apps::AppInstallations>>();
}
for app in apps {
for app in selected_apps {
let versions = match app.list_installed_versions().await {
Ok(versions) => versions,
Err(_) => {
Expand Down

0 comments on commit d88a44b

Please sign in to comment.