aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2022-07-08 13:37:09 -0400
committerBruce Hill <bruce@bruce-hill.com>2022-07-08 13:37:09 -0400
commitf386f15847646d8140d9a1d4c50e9f07d5371d2c (patch)
treeff27371755da508aa606c56f611302858820758e
parent5c86bab04fd4074810210c3dc3579eded2fc223c (diff)
Check for *all* tags instead of *any* tags
-rwxr-xr-xnowopen19
1 files changed, 13 insertions, 6 deletions
diff --git a/nowopen b/nowopen
index 1210260..988e2d9 100755
--- a/nowopen
+++ b/nowopen
@@ -114,16 +114,23 @@ local function get_weekday(str)
end
end
+local function matches_tags(place, tags)
+ for _,request_tag in ipairs(tags) do
+ for _,tag in ipairs(place.tags) do
+ if tag:sub(1,#request_tag) == request_tag then goto next_tag end
+ end
+ if true then return false end
+ ::next_tag::
+ end
+ return true
+end
+
local options = {}
for i,place in ipairs(places) do
if arg[1] then
- for _,request_tag in ipairs(arg) do
- for _,tag in ipairs(place.tags) do
- if tag:sub(1,#request_tag) == request_tag then goto carry_on end
- end
+ if not matches_tags(place, arg) then
+ goto next_place
end
- goto next_place
- ::carry_on::
end
local today_times = nil
for _,time in ipairs(place.times) do