From d223857265812284a693880da070fbc18a3cd1cb Mon Sep 17 00:00:00 2001
From: Hadeed Ahmad <me@hadeedahmad.com>
Date: Sat, 14 Dec 2024 03:42:18 +0500
Subject: [PATCH] Update stow.py

---
 bin/stow.py    | 27 +++++++++++----------------
 git/config     |  3 +++
 zsh/.gitignore |  1 -
 3 files changed, 14 insertions(+), 17 deletions(-)
 delete mode 100644 zsh/.gitignore

diff --git a/bin/stow.py b/bin/stow.py
index cbbea26..0bbc850 100755
--- a/bin/stow.py
+++ b/bin/stow.py
@@ -10,13 +10,10 @@ DOTS = os.getenv("DOTS", os.getcwd())
 def stow(pkg, stow_dir):
     pkg_path = os.path.join(DOTS, pkg)
 
-    for root, dirs, files in os.walk(pkg_path):
-        files = [f for f in files if not f.startswith(".")]
-        dirs[:] = [d for d in dirs if not d.startswith(".")]
-
+    for root, _, files in os.walk(pkg_path):
         symlink_dir = root.replace(pkg_path, stow_dir)
-        if not os.path.exists(symlink_dir):
-            os.makedirs(symlink_dir)
+
+        os.makedirs(symlink_dir, exist_ok=True)
 
         for file in files:
             source = os.path.join(root, file)
@@ -30,14 +27,14 @@ def stow(pkg, stow_dir):
 def get_pkgs():
     pkgs = []
 
-    if len(sys.argv) > 1:
-        for pkg in sys.argv[1:]:
-            if os.path.isdir(os.path.join(DOTS, pkg)):
-                pkgs.append(pkg)
-            else:
-                print(f"The package {pkg} is not a valid package.", file=sys.stderr)
-    else:
-        pkgs = [d for d in os.listdir(DOTS) if not d.startswith(".")]
+    for file in os.listdir(DOTS):
+        if file == ".git":
+            continue
+
+        if os.path.isfile(os.path.join(DOTS, file)):
+            continue
+
+        pkgs.append(file)
 
     return pkgs
 
@@ -51,6 +48,4 @@ def get_stow_dir(pkg):
 
 if __name__ == "__main__":
     for pkg in get_pkgs():
-        if pkg in ["docs"]: continue
-
         stow(pkg, get_stow_dir(pkg))
diff --git a/git/config b/git/config
index 75c3d15..3662b45 100644
--- a/git/config
+++ b/git/config
@@ -8,6 +8,9 @@
 [push]
     autoSetupRemote = true
 
+[pull]
+    rebase = true
+
 [alias]
     s = status -u
     a = add -A
diff --git a/zsh/.gitignore b/zsh/.gitignore
deleted file mode 100644
index ac892c1..0000000
--- a/zsh/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-zsh-secrets