From 86154e4298bdbc1ba6c235ebe0051732b9d6be1d Mon Sep 17 00:00:00 2001 From: Saba Saba Date: Thu, 9 Feb 2023 12:26:24 -0500 Subject: [PATCH] Factored out log-action. --- git-repl.cl | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/git-repl.cl b/git-repl.cl index 626990d..a4b1a63 100644 --- a/git-repl.cl +++ b/git-repl.cl @@ -25,6 +25,11 @@ (export ',name) (defun ,name ,arglist ,@body))) +(defmacro log-action (description &body body) + `(progn + (write-line ,description) + ,@body)) + (defmacro clean-working-directory (&body body) `(if (null (modified-files)) (progn ,@body) @@ -172,26 +177,20 @@ (defun-public stash-config () "Stashes your current configuration by first unskipping it and then stashing it. This operation fails if you have any modified files." (clean-working-directory - (write-line "Unskipping files...") - (no-skip-all) - (write-line "Stashing files...") - (save-stash))) + (log-action "Unskipping files..." (no-skip-all)) + (log-action "Stashing files..." (save-stash)))) (defun-public pop-config () "Pops the stash and skips it to store it as your configuration. This operation fails if you have any modified files." (clean-working-directory - (write-line "Popping stash...") - (pop-stash) - (write-line "Skipping files...") - (skip-modified))) + (log-action "Popping stash..." (pop-stash)) + (log-action "Skipping files..." (skip-modified)))) (defun-public apply-config () "Applies the stash and skips it to store it as your configuration. This operation fails if you have any modified files." (clean-working-directory - (write-line "Applying stash...") - (apply-stash) - (write-line "Skipping files...") - (skip-modified))) + (log-action "Applying stash..." (apply-stash)) + (log-action "Skipping files..." (skip-modified)))) (defun-public config-diff (file-path) "Saves the current configuration to the specified file" -- 2.20.1