Skip to content

Commit

Permalink
feat(api): Add match_query and header to agenda api
Browse files Browse the repository at this point in the history
match_query can be used on tags and tags_todo to match the headlines.
header allow proving custom header name for the view.
  • Loading branch information
kristijanhusak committed Jan 10, 2025
1 parent 6d23709 commit ed49550
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions lua/orgmode/api/agenda.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,36 +46,43 @@ function OrgAgenda.agenda(options)
orgmode.agenda:agenda(opts)
end

---@class OrgAgendaTodosOptions
---@class OrgApiAgendaTodosOptions
---@field filters? OrgApiAgendaFilter
---@field header? string

---@param options? OrgAgendaTodosOptions
---@param options? OrgApiAgendaTodosOptions
function OrgAgenda.todos(options)
options = options or {}
local opts = get_opts(options)
orgmode.agenda:todos(opts)
end

---@class OrgAgendaTagsOptions
---@field filters? OrgApiAgendaFilter
---@class OrgApiAgendaTagsOptions
---@field filters? OrgApiAgendaFilter Agenda filters for tags and categories
---@field match_query? string Match query to find the todos
---@field todo_only? boolean
---@field header? string

---@param options? OrgAgendaTagsOptions
---@param options? OrgApiAgendaTagsOptions
function OrgAgenda.tags(options)
options = options or {}
local opts = get_opts(options)
opts.todo_only = options.todo_only
opts.match_query = options.match_query
orgmode.agenda:tags(opts)
end

---@class OrgAgendaTagsTodoOptions
---@field filters? OrgApiAgendaFilter
---@field todo_only? boolean
---@class OrgApiAgendaTagsTodoOptions
---@field filters? OrgApiAgendaFilter Agenda filters for tags and categories
---@field match_query? string Match query to find the todos
---@field header? string

---@param options? OrgAgendaTagsOptions
---@param options? OrgApiAgendaTagsOptions
function OrgAgenda.tags_todo(options)
options = options or {}
local opts = get_opts(options)
orgmode.agenda:tags(opts)
opts.match_query = options.match_query
orgmode.agenda:tags_todo(opts)
end

return OrgAgenda

0 comments on commit ed49550

Please sign in to comment.