Skip to content

Commit

Permalink
fix: allow ~/TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
aarondill committed Aug 9, 2024
1 parent 9a3f64e commit 414b249
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions module/reminder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ local function add_suffix(filepath, exts, include_original)
:toarray(include_original and { filepath } or nil)
)
end
local home_reminder_paths = { "reminder", ".reminder", ".todo", "todo" }
--- Only all caps or all lower case is allowed
local home_reminder_paths = tables.map_val({ "reminder", ".reminder", ".todo", "todo" }, string.lower)
local extensions = { ".txt", ".md" }
--- These should be /todo, /todo.txt, /todo.md, ...
-- These should be /todo, /reminder, ...
local files_wo_extensions = add_suffix(path.sep, home_reminder_paths, false)
local allowed_files = add_suffix(files_wo_extensions, extensions, true)
local files_wo_extensions_allow_cap =
gtable.join(files_wo_extensions, tables.map_val(files_wo_extensions, string.upper))
--- These should be /todo, /todo.txt, /todo.md, ...
local allowed_files = add_suffix(files_wo_extensions_allow_cap, extensions, true)
--- reminder/todo.txt, todo.txt, .reminder.md, ...
local paths = add_suffix(tables.map_val(home_reminder_paths, path.get_home), gtable.join(extensions, allowed_files))
local index = 1
Expand Down

0 comments on commit 414b249

Please sign in to comment.