1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-10-31 16:44:36 -07:00
rc/home/ea

38 lines
804 B
Bash

#!/usr/bin/env bash
# remote file access (http file-sharing shenanigans)
_REMOTE_DOMAIN="https://eaguru.guru"
_REMOTE_DIR="t"
_REMOTE_AUTH="auth"
eahead() {
curl -s -I "$_REMOTE_DOMAIN/$_REMOTE_DIR/$1"
}
eaget() {
curl -R "$_REMOTE_DOMAIN/$_REMOTE_DIR/$1" -o "${2:-$1}"
}
eaput() {
curl -g -n -T "$1" "$_REMOTE_DOMAIN/$_REMOTE_AUTH/"
}
eamove() {
local src="$_REMOTE_DOMAIN/$_REMOTE_AUTH/$1"
local dst="$_REMOTE_DOMAIN/$_REMOTE_DIR/$2"
curl -n -X MOVE -H "Destination: $dst" "$src"
}
eacopy() {
local src="$_REMOTE_DOMAIN/$_REMOTE_AUTH/$1"
local dst="$_REMOTE_DOMAIN/$_REMOTE_DIR/$2"
curl -n -X COPY -H "Destination: $dst" "$src"
}
eadelete() {
curl -n -X DELETE "$_REMOTE_DOMAIN/$_REMOTE_AUTH/$1"
}
alias eamv=eamove
alias eacp=eacopy
alias earm=eadelete