From ed699e596ada663f11940b3a0b7490a430072c38 Mon Sep 17 00:00:00 2001 From: Isaac Shoebottom Date: Tue, 11 Mar 2025 11:23:54 -0300 Subject: [PATCH] Improve alias usage --- dot_zshrc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/dot_zshrc b/dot_zshrc index 4da11fe..e1306f7 100644 --- a/dot_zshrc +++ b/dot_zshrc @@ -31,22 +31,41 @@ function ls { # Dotfiles management function .add { + if [[ -z $1 || -z $2 ]]; then + echo "Usage: .add " + return 1 + fi + chezmoi add $1 + chezmoi git status chezmoi git diff if $(read -q "?Commit changes? [y/N]"); then chezmoi git commit -- -am $2 + if $(read -q "?Push changes? [y/N]"); then + chezmoi git push + fi fi } function .re-add { + if [[ -z $1 ]]; then + echo "Usage: .re-add " + return 1 + fi + chezmoi re-add + chezmoi git status chezmoi git diff if $(read -q "?Commit changes? [y/N]"); then chezmoi git commit -- -am $1 + if $(read -q "?Push changes? [y/N]"); then + chezmoi git push + fi fi } alias .push="chezmoi git push" alias .pull="chezmoi git pull" alias .status="chezmoi git status" +alias .diff="chezmoi git diff" alias .update="chezmoi update"