Skip to content

Commit

Permalink
chwd: Make argument for autoconfigure optional (#133)
Browse files Browse the repository at this point in the history
It allows us to replace install-gpu-drivers script in calamares just by
running ``chwd --autoconfigure``.
  • Loading branch information
ventureoo authored Aug 22, 2024
1 parent 2589f67 commit a7c4e44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub struct Args {
pub list_all: bool,

/// Autoconfigure
#[arg(short, long, value_name = "classid", conflicts_with_all(["install", "remove"]))]
#[arg(short, long, value_name = "classid", conflicts_with_all(["install", "remove"]), default_missing_value = "any", num_args(0..=1))]
pub autoconfigure: Option<String>,

/// Toggle AI SDK profiles
Expand Down
6 changes: 4 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ fn prepare_autoconfigure(

let mut found_device = false;
for device in devices.iter() {
if device.class_id != autoconf_class_id {
if autoconf_class_id != "any" && device.class_id != autoconf_class_id {
continue;
}
found_device = true;
Expand All @@ -183,7 +183,9 @@ fn prepare_autoconfigure(
device.device_name
);
if profile.is_none() {
log::warn!("No config found for device: {device_info}");
if autoconf_class_id != "any" {
log::warn!("No config found for device: {device_info}");
}
continue;
}
let profile = profile.unwrap();
Expand Down

0 comments on commit a7c4e44

Please sign in to comment.