summaryrefslogtreecommitdiff
path: root/lib/util.ex
diff options
context:
space:
mode:
authorJordan Bracco <href@random.sh>2025-06-26 20:51:13 +0200
committerJordan Bracco <href@random.sh>2025-06-26 20:51:13 +0200
commit4242698bdc0bb2a5576fbeb7f93831cb5a7e3ec4 (patch)
tree0cc3ec0be6669032a45d23f5962ff8852aacd0a6 /lib/util.ex
parentconn: fix tls opts (diff)
link: improve quirks
Diffstat (limited to 'lib/util.ex')
-rw-r--r--lib/util.ex13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/util.ex b/lib/util.ex
index 71fddab..dea7834 100644
--- a/lib/util.ex
+++ b/lib/util.ex
@@ -81,4 +81,17 @@ defmodule Util do
do_ets_mutate_each(ets, table, fun, ets.next(table, key))
end
+
+ def read_file_list!(path) do
+ path
+ |> File.read!()
+ |> String.split("\n")
+ |> Enum.map(fn line ->
+ if !String.starts_with?(line, "#") do
+ String.trim(line)
+ end
+ end)
+ |> Enum.filter(& &1)
+ |> Enum.filter(&(&1 != ""))
+ end
end