Skip to content

Commit 5ce4514

Browse files
committed
fix(cli): fix exclude help and fmt
1 parent cb40774 commit 5ce4514

3 files changed

Lines changed: 12 additions & 17 deletions

File tree

crates/soar-cli/src/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ pub enum Commands {
407407
#[arg(required = false, short, long = "match")]
408408
match_keywords: Option<Vec<String>>,
409409

410-
/// Check if the asset contains given string
410+
/// Exclude assets that contain the given string
411411
#[arg(required = false, short, long = "exclude")]
412412
exclude_keywords: Option<Vec<String>>,
413413

crates/soar-core/src/package/install.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -563,9 +563,8 @@ impl PackageInstaller {
563563
.with_context(|| format!("creating directory {}", parent.display()))?;
564564
}
565565

566-
fs::copy(src, dest).with_context(|| {
567-
format!("copying {} to {}", src.display(), dest.display())
568-
})?;
566+
fs::copy(src, dest)
567+
.with_context(|| format!("copying {} to {}", src.display(), dest.display()))?;
569568

570569
// Honor checksum pinning the same way the direct-download path does.
571570
if let Some(ref bsum) = self.package.bsum {

crates/soar-core/src/package/local.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ impl LocalPackage {
5757
return false;
5858
}
5959

60-
resolve_path(candidate)
61-
.map(|p| p.exists())
62-
.unwrap_or(false)
60+
resolve_path(candidate).map(|p| p.exists()).unwrap_or(false)
6361
}
6462

6563
/// Parse a local file path and extract package metadata.
@@ -87,7 +85,10 @@ impl LocalPackage {
8785
.file_name()
8886
.map(|s| s.to_string_lossy().into_owned())
8987
.ok_or_else(|| {
90-
SoarError::Custom(format!("Could not extract filename from {}", path.display()))
88+
SoarError::Custom(format!(
89+
"Could not extract filename from {}",
90+
path.display()
91+
))
9192
})?;
9293

9394
let size = path.metadata().ok().map(|m| m.len());
@@ -156,9 +157,7 @@ impl LocalPackage {
156157
/// Strip the `file://` scheme from a download URL, returning the local path
157158
/// if the URL refers to a local source.
158159
pub fn local_path_from_url(download_url: &str) -> Option<&Path> {
159-
download_url
160-
.strip_prefix(LOCAL_SCHEME)
161-
.map(Path::new)
160+
download_url.strip_prefix(LOCAL_SCHEME).map(Path::new)
162161
}
163162

164163
#[cfg(test)]
@@ -190,8 +189,7 @@ mod tests {
190189
let tmp = std::env::temp_dir().join("MyApp-2.0.1-x86_64.AppImage");
191190
std::fs::write(&tmp, b"\x7fELF").unwrap();
192191

193-
let pkg =
194-
LocalPackage::from_path(&tmp.to_string_lossy(), None, None, None, None).unwrap();
192+
let pkg = LocalPackage::from_path(&tmp.to_string_lossy(), None, None, None, None).unwrap();
195193

196194
assert_eq!(pkg.pkg_name, "myapp");
197195
assert_eq!(pkg.version, "2.0.1");
@@ -211,8 +209,7 @@ mod tests {
211209
let tmp = std::env::temp_dir().join("soar_local_test_blob.bin");
212210
std::fs::write(&tmp, [0x1f, 0x8b, 0x08, 0x00]).unwrap();
213211

214-
let pkg =
215-
LocalPackage::from_path(&tmp.to_string_lossy(), None, None, None, None).unwrap();
212+
let pkg = LocalPackage::from_path(&tmp.to_string_lossy(), None, None, None, None).unwrap();
216213
assert_eq!(pkg.pkg_type, Some("archive".to_string()));
217214

218215
std::fs::remove_file(&tmp).ok();
@@ -223,8 +220,7 @@ mod tests {
223220
let tmp = std::env::temp_dir().join("soar_local_test_binary");
224221
std::fs::write(&tmp, b"\x7fELF\x02\x01\x01\x00").unwrap();
225222

226-
let pkg =
227-
LocalPackage::from_path(&tmp.to_string_lossy(), None, None, None, None).unwrap();
223+
let pkg = LocalPackage::from_path(&tmp.to_string_lossy(), None, None, None, None).unwrap();
228224
assert_eq!(pkg.pkg_type, None);
229225

230226
std::fs::remove_file(&tmp).ok();

0 commit comments

Comments
 (0)