From 9aba368f6c9fe65e863f597f90e32ed7e1562122 Mon Sep 17 00:00:00 2001 From: "Mariano Z." Date: Sat, 10 May 2025 21:33:40 -0300 Subject: [PATCH] automated dev commit --- zsh/.config/zsh/functions.zsh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/zsh/.config/zsh/functions.zsh b/zsh/.config/zsh/functions.zsh index ae77ead..42bd1d4 100644 --- a/zsh/.config/zsh/functions.zsh +++ b/zsh/.config/zsh/functions.zsh @@ -301,7 +301,18 @@ if command -v bombadil &> /dev/null; then eval "$(bombadil generate-completions if command -v eza &> /dev/null; then compdef eza=ls; fi function dc() { + if ! git rev-parse --is-inside-work-tree &>/dev/null; then + echo "Error: Not in a git repository" + return 1 + fi + + if [[ -z $(git status --porcelain) ]]; then + echo "No changes to commit" + return 0 + fi + git add . - git commit -m 'automated dev commit' --no-gpg-sign - git push + local timestamp=$(date +"%Y-%m-%d %H:%M:%S") + git commit -m "dev: automated commit - ${timestamp}" --no-gpg-sign + git push &>/dev/null }