Add project and deadline properties
* ogi.el (ogi--project): New "internal" variable. (ogi-insert-entry): Add `GH_PROJECT' property to identify which github property an entry came from. Only add a `MILESTONE' property when it has a name (as in, when it exists). Add a `DEADLINE' to the entry if the milestone has a due date. (ogi-get-for): Rename from `ogi-insert', which is kind of non-descript. Bind `ogi--project' to whichever project we're fetching so other functions can use it.
This commit is contained in:
parent
7fbf663ea5
commit
1d302fadc0
1 changed files with 18 additions and 3 deletions
21
ogi.el
21
ogi.el
|
@ -28,6 +28,9 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(defvar ogi--project nil
|
||||
"Container for the name of the project we're fetching.")
|
||||
|
||||
(defun ogi-get (project)
|
||||
"Get a list of open issues for PROJECT."
|
||||
(let* ((url-request-extra-headers
|
||||
|
@ -68,14 +71,26 @@
|
|||
(replace-regexp-in-string
|
||||
"-" "_" (ogiprop itm name)))
|
||||
(ogiprop issue labels)))
|
||||
(org-entry-put (point) "ID" id))))
|
||||
(org-entry-put (point) "ID" id)
|
||||
(org-entry-put (point) "GH_PROJECT" ogi--project)
|
||||
|
||||
(let* ((milestone (ogiprop issue milestone))
|
||||
(title (ogiprop milestone title))
|
||||
(due-on (ogiprop milestone due_on)))
|
||||
(when title
|
||||
(org-entry-put (point) "MILESTONE" title)
|
||||
(when due-on
|
||||
(message due-on)
|
||||
(org-deadline
|
||||
nil (replace-regexp-in-string "[TZ]" " " due-on))))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun ogi-insert (project)
|
||||
(defun ogi-get-for (project)
|
||||
"Insert (new) issues for PROJECT under the current entry."
|
||||
(interactive "MGet issues for: ")
|
||||
(goto-char (point-max))
|
||||
(mapc #'ogi-insert-entry (ogi-get project)))
|
||||
(let ((ogi--project project))
|
||||
(mapc #'ogi-insert-entry (ogi-get project))))
|
||||
|
||||
(provide 'ogi)
|
||||
|
||||
|
|
Loading…
Reference in a new issue