Switch to thread-last for +eshell-prompt/--git-status

This commit is contained in:
2025-05-08 23:58:32 +01:00
parent c94f66c143
commit 3c39e59cd5

View File

@@ -82,9 +82,11 @@ number of files affected are returned in red."
(defun +eshell-prompt/--git-status () (defun +eshell-prompt/--git-status ()
"Returns a completely formatted string of "Returns a completely formatted string of
form (BRANCH-NAME<CHANGES>[REMOTE-STATUS])." form (BRANCH-NAME<CHANGES>[REMOTE-STATUS])."
(let ((git-branch (shell-command-to-string "git branch"))) (let ((git-branch (thread-last
(if (or (string= git-branch "") (split-string (shell-command-to-string "git branch") "\n")
(not (string= "*" (substring git-branch 0 1)))) (cl-remove-if (lambda (s) (= (length s) 0)))
(cl-find-if (lambda (s) (string= "*" (substring s 0 1)))))))
(if (null git-branch)
"" ""
(format (format
"(%s<%s>[%s])" "(%s<%s>[%s])"