fix indentation

This commit is contained in:
axtlos 2024-06-09 15:58:33 +02:00
parent cbe8a0cdf4
commit 04bd3c4653
Failed to generate hash of commit

View file

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