> DOCS_
Add to .bashrc / .zshrc:
vershare() {
local BASE="https://vershare.uk"
if [ -f "$1" ]; then
local mime=$(file -b --mime-type "$1")
local type="file"
[[ "$mime" == image/* ]] && type="image"
curl -s -X POST "$BASE/api/shares" \
-F "type=$type" -F "file=@$1" | jq -r '.url'
elif [ -n "$1" ]; then
curl -s -X POST "$BASE/api/shares" \
-H 'Content-Type: application/json' \
-d "$(jq -nc --arg c "$1" '{type:"text",content:$c}')" | jq -r '.url'
else
local content=$(cat)
curl -s -X POST "$BASE/api/shares" \
-H 'Content-Type: application/json' \
-d "$(jq -nc --arg c "$content" '{type:"text",content:$c}')" | jq -r '.url'
fi
}EXAMPLES
# Share a file
vershare report.pdf# Share an image
vershare screenshot.png# Share text
vershare "hello world"# Pipe stdin
echo "data" | vershare# Clipboard (macOS)
pbpaste | vershare# Share & copy link
vershare notes.md | pbcopyRequires curl + jq. Install: brew install jq or apt install jq