diff options
-rw-r--r-- | .config/git/config | 5 | ||||
-rwxr-xr-x | dots | 57 |
2 files changed, 62 insertions, 0 deletions
diff --git a/.config/git/config b/.config/git/config index 9304359..ee3725c 100644 --- a/.config/git/config +++ b/.config/git/config @@ -3,3 +3,8 @@ name = Aki [init] defaultBranch = master +[sendemail] + smtpencryption = tls + smtpserver = mail.ignore.pl + smtpuser = aki + smtpserverport = 587 @@ -0,0 +1,57 @@ +#!/bin/bash +shopt -s globstar nullglob dotglob +REPO="$(realpath "$(dirname "$0")")" + + +ignored() { + case $1 in + .gitignore|dots|.git|.git/*) return 0;; + *) return 1;; + esac +} + + +get() { + for file in **; do + ignored "$file" && continue + [ -f "$HOME/$file" ] && cp "$HOME/$file" "$REPO/$file" + done +} + + +put() { + for file in **; do + ignored "$file" && continue + if [ -f "$HOME/$file" ]; then + diff "$REPO/$file" "$HOME/$file" >/dev/null 2>/dev/null && continue + cp "$HOME/$file" "$HOME/$file.bak.$(date +%Y%m%d)" + fi + cp "$REPO/$file" "$HOME/$file" + done +} + + +clear() { + for file in **; do + ignored "$file" && continue + for bak in "$HOME/$file".bak.*; do + rm "$bak" + done + done +} + + +list() { + for file in **; do + ignored "$file" || echo "$file" + done +} + + +case $1 in +get) get;; +put) put;; +clear) clear;; +list) list;; +*) exit 1;; +esac |