From 117cc5702cd4f1f4166befaff74196ceaad8d7dc Mon Sep 17 00:00:00 2001 From: Ag Ibragimov Date: Wed, 30 Apr 2025 16:39:18 -0500 Subject: [PATCH] feat(doom-cli): shows diff in terminal if gh is found --- lisp/cli/upgrade.el | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lisp/cli/upgrade.el b/lisp/cli/upgrade.el index 88141a553f1..c365141e01e 100644 --- a/lisp/cli/upgrade.el +++ b/lisp/cli/upgrade.el @@ -134,11 +134,18 @@ libraries. It is the equivalent of the following shell commands: this-rev new-rev))) (print! "Link to diff: %s" diff-url) - (when (and (not auto-accept-p) - (y-or-n-p "View the comparison diff in your browser?")) - (print! (item "Opened github in your browser.")) - (browse-url diff-url))) - + (if-let* ((gh (executable-find "gh")) + (cmd (format "%s api repos/doomemacs/doomemacs/compare/%s...%s" + gh this-rev new-rev))) + (progn + (when-let* ((delta (executable-find "delta"))) + (setq cmd (format "%s | %s --paging=never" cmd delta))) + (print! "Comparison diff: %s" diff-url) + (sh! cmd)) + (when (and (not auto-accept-p) + (y-or-n-p "View the comparison diff in your browser?")) + (print! (item "Opened github in your browser.")) + (browse-url diff-url)))) (if (not (or auto-accept-p (y-or-n-p "Proceed with upgrade?"))) (ignore (print! (error "Aborted")))