1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-11-05 07:29:04 -08:00
rc/sh/ea

43 lines
975 B
Text

#!/usr/bin/env false
# remote file access (http file-sharing shenanigans)
# YES_ZSH
# YES_BASH
# YES_DASH
_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 ### @-
# TODO: write "ea" interface with subcommands for each action, invoke it.