mirror of
https://github.com/denisidoro/navi
synced 2024-11-21 19:13:07 +00:00
Fix allowlist logic (#520)
This commit is contained in:
parent
9d9ae304ba
commit
639e1dc46a
1 changed files with 15 additions and 7 deletions
|
@ -111,13 +111,7 @@ fn write_cmd(
|
|||
if item.snippet.len() <= 1 {
|
||||
return Ok(());
|
||||
}
|
||||
if let Some(list) = allowlist {
|
||||
for v in list {
|
||||
if !item.tags.contains(v) {
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(list) = denylist {
|
||||
for v in list {
|
||||
if item.tags.contains(v) {
|
||||
|
@ -125,6 +119,20 @@ fn write_cmd(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(list) = allowlist {
|
||||
let mut should_allow = false;
|
||||
for v in list {
|
||||
if item.tags.contains(v) {
|
||||
should_allow = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if !should_allow {
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
return stdin
|
||||
.write_all(writer::write(item).as_bytes())
|
||||
.context("Failed to write command to finder's stdin");
|
||||
|
|
Loading…
Reference in a new issue