summaryrefslogtreecommitdiff
path: root/functions/sourceall
diff options
context:
space:
mode:
authorChloe Kudryavtsev <toast@toast.cafe>2020-02-14 19:11:04 -0500
committerChloe Kudryavtsev <toast@toast.cafe>2020-02-14 19:11:04 -0500
commit858a4a31a251d0eab21dffb96776aca007dafb07 (patch)
tree54d0b73cab4eb4bc6c023ad4a75a5de0e724ed1f /functions/sourceall
Squashed 'dot_local/share/toasty/' content from commit aee4da7
git-subtree-dir: dot_local/share/toasty git-subtree-split: aee4da752bdb07b0524bb8803ead46d4093fa57f
Diffstat (limited to 'functions/sourceall')
-rw-r--r--functions/sourceall16
1 files changed, 16 insertions, 0 deletions
diff --git a/functions/sourceall b/functions/sourceall
new file mode 100644
index 0000000..b63c58b
--- /dev/null
+++ b/functions/sourceall
@@ -0,0 +1,16 @@
+#!/bin/zsh
+local ext=
+local f=
+local p=
+
+# calling `sourceall zsh` will source *.zsh, otherwise *
+(( $# > 0 )) && ext=".$1"
+
+for p in $apath
+do
+ [[ -d $p ]] || continue
+ for f in $p/*$ext(.N)
+ do
+ [[ -r $f ]] && . $f
+ done
+done