Commit 45c71d82 authored by Jonas Bernoulli's avatar Jonas Bernoulli

magit--format-popup-variable:values: new function

parent c51075b5
......@@ -1828,6 +1828,20 @@ the reference is used. The first regexp submatch becomes the
;;;; Variables in Popups
(defun magit--format-popup-variable:values (variable width &optional global)
(concat variable
(make-string (max 1 (- width 3 (length variable))) ?\s)
(-if-let (values (magit-get-all (and global "--global") variable))
(concat
(propertize (car values) 'face 'magit-popup-option-value)
(mapconcat
(lambda (value)
(concat "\n" (make-string width ?\s)
(propertize value
'face 'magit-popup-option-value)))
(cdr values) ""))
(propertize "unset" 'face 'magit-popup-disabled-argument))))
(defun magit--set-popup-variable
(variable choices &optional default other)
(magit-set (--if-let (magit-git-string "config" "--local" variable)
......
......@@ -323,19 +323,9 @@ Delete the symbolic-ref \"refs/remotes/<remote>/HEAD\"."
(magit-refresh))
(defun magit-remote-config--format-variable (variable)
(let* ((remote (magit-remote-config--remote))
(var (format "remote.%s.%s" remote variable)))
(concat var (make-string (max 1 (- 8 (length variable))) ?\s)
(-if-let (values (magit-get-all var))
(concat
(propertize (car values) 'face 'magit-popup-option-value)
(mapconcat
(lambda (value)
(concat "\n" (make-string 25 ?\s)
(propertize value
'face 'magit-popup-option-value)))
(cdr values) ""))
(propertize "unset" 'face 'magit-popup-disabled-argument)))))
(magit--format-popup-variable:values
(format "remote.%s.%s" (magit-remote-config--remote) variable)
25))
;;; Fetch
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment