summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config/git/config5
-rwxr-xr-xdots57
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
diff --git a/dots b/dots
new file mode 100755
index 0000000..532e6c7
--- /dev/null
+++ b/dots
@@ -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