fix indentation

This commit is contained in:
axtlos 2024-06-09 15:58:33 +02:00
parent cbe8a0cdf4
commit 04bd3c4653
No known key found for this signature in database
GPG Key ID: DD6D66939396C90E

View File

@ -15,39 +15,39 @@ fn main() {
let mut found = false; let mut found = false;
let home = match env::var("HOME") { let home = match env::var("HOME") {
Ok(var) => var, Ok(var) => var,
Err(_) => exit(1), Err(_) => exit(1),
}; };
for dirs in data_dirs { for dirs in data_dirs {
if (dirs.starts_with(&home) && cli.skip_home) || (dirs.starts_with(".") && cli.skip_dot) { if (dirs.starts_with(&home) && cli.skip_home) || (dirs.starts_with(".") && cli.skip_dot) {
continue continue
} }
let files = match fs::read_dir(format!("{}/applications",dirs)) { let files = match fs::read_dir(format!("{}/applications",dirs)) {
Ok(file) => file, Ok(file) => file,
Err(_) => continue, Err(_) => continue,
}; };
for file in files { for file in files {
let desktop_file = format!("{}", file.as_ref().unwrap().file_name().into_string().unwrap()); let desktop_file = format!("{}", file.as_ref().unwrap().file_name().into_string().unwrap());
let mut name = desktop_file.split("."); let mut name = desktop_file.split(".");
if name.find(|x| *x == cli.search.strip_suffix(".desktop").unwrap_or(&cli.search)).is_some() { if name.find(|x| *x == cli.search.strip_suffix(".desktop").unwrap_or(&cli.search)).is_some() {
let path = file.as_ref().unwrap().path(); let path = file.as_ref().unwrap().path();
let out = if cli.show_tilde { let out = if cli.show_tilde {
format!("{}", path.display().to_string().replace(&home, "~")) format!("{}", path.display().to_string().replace(&home, "~"))
} else { } else {
path.display().to_string() path.display().to_string()
}; };
println!("{}", out); println!("{}", out);
found = true; found = true;
if !cli.all { if !cli.all {
return return
} }
}
} }
}
} }
if !found { if !found {
eprintln!("No {} in ({})", args[1], xdg_data_dirs); eprintln!("No {} in ({})", args[1], xdg_data_dirs);
exit(1); exit(1);
} }
} }