From: Saba Saba Date: Thu, 9 Feb 2023 17:26:24 +0000 (-0500) Subject: Factored out log-action. X-Git-Url: http://sabadev.xyz:4321/?a=commitdiff_plain;h=86154e4298bdbc1ba6c235ebe0051732b9d6be1d;p=git-repl.git Factored out log-action. --- 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"