From d86723e5be25dd540a85e819b59f320212142f5c Mon Sep 17 00:00:00 2001 From: Tony Blyler Date: Wed, 11 May 2022 19:29:17 -0400 Subject: [PATCH] Update chezmoi zsh file to prompt before showing a diff --- chezmoi/dot_zshrc.d/executable_chezmoi.zsh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/chezmoi/dot_zshrc.d/executable_chezmoi.zsh b/chezmoi/dot_zshrc.d/executable_chezmoi.zsh index 92b3c83..6ecc9df 100644 --- a/chezmoi/dot_zshrc.d/executable_chezmoi.zsh +++ b/chezmoi/dot_zshrc.d/executable_chezmoi.zsh @@ -36,12 +36,27 @@ exit 0 fi + while true; do + read -r 'CONTINUE?Chezmoi has updates, review now? [y/N] ' + + case "$CONTINUE" in + 'y'|'Y'|'YES'|'yes'|'Yes') + break + ;; + + 'n'|'N'|'NO'|'no'|'No'|'') + echo 'not applying changes' + exit 0 + ;; + esac + done + chezmoi diff while true; do read -r 'APPLY?apply? [y/N] ' - case "${APPLY:-}" in + case "$APPLY" in 'y'|'Y'|'YES'|'yes'|'Yes') echo 'applying changes' chezmoi apply