mirror of
https://codeberg.org/axtlos/deskwhich.git
synced 2025-01-12 23:37:45 +01:00
fix indentation
This commit is contained in:
parent
cbe8a0cdf4
commit
04bd3c4653
1 changed files with 28 additions and 28 deletions
56
src/main.rs
56
src/main.rs
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue