#!/bin/rc
. ~/.config/sr.ht
paste=https://paste.sr.ht
fname=`{tofi \
	--require-match=false \
	--prompt-text 'File name: ' \
	</dev/null}
if (test $#fname -eq 0) {
	exit
}

data=`{wl-paste --no-newline | jq -sR '{
	"files": [
		{
			"contents": .,
			"filename": "'"$fname"'",
		}
	],
	"visibility": "unlisted"
}'}
url=`{wl-paste | hut paste create -n $fname}
xdg-open $url
wl-copy $url
