summaryrefslogtreecommitdiff
path: root/dot_local/share/toasty/functions
diff options
context:
space:
mode:
Diffstat (limited to 'dot_local/share/toasty/functions')
-rw-r--r--dot_local/share/toasty/functions/autosource10
-rw-r--r--dot_local/share/toasty/functions/brpaste6
-rw-r--r--dot_local/share/toasty/functions/sourceall16
-rw-r--r--dot_local/share/toasty/functions/sprunge2
4 files changed, 34 insertions, 0 deletions
diff --git a/dot_local/share/toasty/functions/autosource b/dot_local/share/toasty/functions/autosource
new file mode 100644
index 0000000..12b6bab
--- /dev/null
+++ b/dot_local/share/toasty/functions/autosource
@@ -0,0 +1,10 @@
+#!/bin/zsh
+local f=
+local p=
+for f
+do
+ for p in $spath
+ do
+ [[ -r $p/$f ]] && . "$p/$f" && break
+ done
+done
diff --git a/dot_local/share/toasty/functions/brpaste b/dot_local/share/toasty/functions/brpaste
new file mode 100644
index 0000000..b4cf5ef
--- /dev/null
+++ b/dot_local/share/toasty/functions/brpaste
@@ -0,0 +1,6 @@
+#!/bin/zsh
+host='https://brpaste.xyz'
+[[ $# -eq 0 ]] && set -- '-'
+brpaste_id=$(curl -\#fF "data=<$1" "$host") \
+ || { echo 'ERROR: Upload failed!' >&2 && return 1; }
+printf '%s/%s\n' "$host" "$brpaste_id"
diff --git a/dot_local/share/toasty/functions/sourceall b/dot_local/share/toasty/functions/sourceall
new file mode 100644
index 0000000..b63c58b
--- /dev/null
+++ b/dot_local/share/toasty/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
diff --git a/dot_local/share/toasty/functions/sprunge b/dot_local/share/toasty/functions/sprunge
new file mode 100644
index 0000000..c76ed76
--- /dev/null
+++ b/dot_local/share/toasty/functions/sprunge
@@ -0,0 +1,2 @@
+#!/bin/zsh
+curl -F 'sprunge=<-' http://sprunge.us