zshrc: add putdir function

recursively HTTP PUT a whole directory

if reading fails, attempt listing as directory
This commit is contained in:
xfnw 2024-01-08 09:38:08 -05:00
parent fcde6e924e
commit b563c5bf69
1 changed files with 1 additions and 0 deletions

1
.zshrc
View File

@ -19,6 +19,7 @@ base58gen() { echo $(base64 /dev/urandom | tr -d "\n/+Il0O$2" | head -c ${$(($1/
vid() { echo "VULP$(base64 /dev/urandom | tr -d "\n/+I0Oa-z" | head -c 17)" ; }
tuch() { touch "$@" ; chmod 755 "$@" ; ${EDITOR:-vim} "$@" ; }
rot13() { tr 'a-zA-Z' 'n-za-mN-ZA-M' ; }
putdir(){ find "${@:2}" | while IFS= read fname ; do curl -X PUT --data-binary "@$fname" "$1$fname" || ls -l -- "$fname" | curl -X PUT --data-binary @- "$1$fname" ; done ; }
meili() { curl -X POST "http://$1:7700/indexes/$2?$3" -H 'Content-Type: application/json' --data-binary @- ; }
meiliset() { curl -X PATCH "http://$1:7700/indexes/$2/settings" -H 'Content-Type: application/json' --data-binary @- ; }
meilit() { curl "http://$1:7700/tasks/$2" ; }