Function: projectile--taskfile-task-names

projectile--taskfile-task-names is a byte-compiled function defined in projectile.el.

Signature

(projectile--taskfile-task-names FILE)

Documentation

Return the keys of the top-level tasks: mapping in the Taskfile FILE.

Those are the lines indented exactly one level under it; anything deeper belongs to a task rather than naming one.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile--taskfile-task-names (file)
  "Return the keys of the top-level `tasks:' mapping in the Taskfile FILE.
Those are the lines indented exactly one level under it; anything deeper
belongs to a task rather than naming one."
  (with-temp-buffer
    (insert-file-contents file)
    (goto-char (point-min))
    (let ((case-fold-search nil)
          names)
      (when (re-search-forward "^tasks:[ \t]*$" nil t)
        (forward-line 1)
        (let ((indent (current-indentation)))
          (while (and (not (eobp))
                      (or (looking-at-p "^[ \t]*$")
                          (< 0 (current-indentation))))
            (when (and (= (current-indentation) indent)
                       (looking-at "[ \t]+\\([a-zA-Z0-9_.:-]+\\):"))
              (let ((name (match-string 1)))
                (unless (member name names)
                  (push name names))))
            (forward-line 1))))
      (nreverse names))))