Function: majutsu-workspace-parse-list-output

majutsu-workspace-parse-list-output is a natively compiled function defined in majutsu-workspace.el.

Signature

(majutsu-workspace-parse-list-output OUTPUT &optional PLAN)

Documentation

Parse `jj workspace list -T ... OUTPUT into a list of entry plists.

Each entry contains:
- :name workspace name (string)
- :current non-nil when it is the current workspace
- :change-id short change id of the workspaces working-copy commit
- :commit-id short commit id of the workspace's working-copy commit
- :desc first-line description of the working-copy commit
- :root workspace root directory, or nil if unavailable

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-workspace.el
(defun majutsu-workspace-parse-list-output (output &optional plan)
  "Parse `jj workspace list -T ...` OUTPUT into a list of entry plists.

Each entry contains:
- :name       workspace name (string)
- :current    non-nil when it is the current workspace
- :change-id  short change id of the workspace's working-copy commit
- :commit-id  short commit id of the workspace's working-copy commit
- :desc       first-line description of the working-copy commit
- :root       workspace root directory, or nil if unavailable"
  (let ((entries nil)
        (plan (or plan (majutsu-workspace--ensure-template-plan)))
        (output (let ((ansi-color-apply-face-function
                       #'ansi-color-apply-text-property-face))
                  (ansi-color-apply (or output "")))))
    (let* ((width (length (plist-get plan :fields)))
           (values (majutsu-workspace--split-fields output)))
      (while (>= (length values) width)
        (when-let* ((entry (majutsu-workspace--parse-record
                            (cl-subseq values 0 width) plan)))
          (push entry entries))
        (setq values (nthcdr width values))))
    (nreverse entries)))