Skip to content

Commit 0df4b64

Browse files
committed
feat: shows diff in terminal
if gh is found
1 parent ca7e226 commit 0df4b64

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

lisp/cli/upgrade.el

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,18 @@ libraries. It is the equivalent of the following shell commands:
134134
this-rev
135135
new-rev)))
136136
(print! "Link to diff: %s" diff-url)
137-
(when (and (not auto-accept-p)
138-
(y-or-n-p "View the comparison diff in your browser?"))
139-
(print! (item "Opened github in your browser."))
140-
(browse-url diff-url)))
141-
137+
(if-let* ((gh (executable-find "gh"))
138+
(cmd (format "%s api repos/doomemacs/doomemacs/compare/%s...%s"
139+
gh this-rev new-rev)))
140+
(progn
141+
(when-let* ((delta (executable-find "delta")))
142+
(setq cmd (format "%s | %s --paging=never" cmd delta)))
143+
(print! "Comparison diff: %s" diff-url)
144+
(sh! cmd))
145+
(when (and (not auto-accept-p)
146+
(y-or-n-p "View the comparison diff in your browser?"))
147+
(print! (item "Opened github in your browser."))
148+
(browse-url diff-url))))
142149
(if (not (or auto-accept-p
143150
(y-or-n-p "Proceed with upgrade?")))
144151
(ignore (print! (error "Aborted")))

0 commit comments

Comments
 (0)