summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authoraxtlos <axtlos@getcryst.al>2024-06-09 15:58:33 +0200
committeraxtlos <axtlos@getcryst.al>2024-06-09 15:58:33 +0200
commit04bd3c4653ee770901d7f4974c2ebca17b53abe7 (patch)
tree20c9f89c4d64d5ec03cf289bdca4606ec8803e18 /src/main.rs
parentcbe8a0cdf4bdbb26faecb028e79ad6c409376051 (diff)
downloaddeskwhich-04bd3c4653ee770901d7f4974c2ebca17b53abe7.tar.gz
deskwhich-04bd3c4653ee770901d7f4974c2ebca17b53abe7.tar.bz2
fix indentationHEADmain
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/main.rs b/src/main.rs
index 27a4a79..fb33105 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -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
- }
+ 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
- }
+ 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);
}
}