From 942ddfa4fb33bb41ae4f26a6933ace1bb36e5e7d Mon Sep 17 00:00:00 2001
From: PowerUser64 <blakelysnorth@gmail.com>
Date: Thu, 14 Apr 2022 21:35:52 -0700
Subject: [PATCH] cda: now takes arguments for what dirs to open

---
 .config/shell/functions/cda | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/.config/shell/functions/cda b/.config/shell/functions/cda
index 751734b..3dfe301 100644
--- a/.config/shell/functions/cda
+++ b/.config/shell/functions/cda
@@ -1,10 +1,10 @@
-#!/bin/bash
-# Source this and then run `cda`
+#!/bin/sh
+# Usage:
+#  cda <dirs>
 
-# cd all: opens a new shell in each of the directories below the one you're in, so
-# you can execute commands in them until you type 'exit'
-# If I use this enough, I may make something that can do more
-# Ideas for what it could do in the future:
+# cd all: opens a new shell in each of the passed dirs
+
+# Ideas for improvement:
 # - somehow record typed commands so they can be automatically repeated like a macro
 #     - maybe get the length of the histfile before and after, executing the last X number of commands
 # - Maybe just add an argument that takes a command and executes it in all dirs
@@ -12,8 +12,11 @@
 # that by just writing a for loop)
 
 cda() {
-   for DIR in *; do
-      (cd "$DIR" && zsh)
+   for DIR in "$@"; do
+      echo
+      echo "$DIR"
+      (cd "$DIR" && $SHELL)
    done
+   echo "$0: done"
 }