Skip to content

Instantly share code, notes, and snippets.

@brandonkrull
Created June 21, 2018 17:15
Show Gist options
  • Save brandonkrull/7ae4247dbfe13677df18897b3291ea56 to your computer and use it in GitHub Desktop.
Save brandonkrull/7ae4247dbfe13677df18897b3291ea56 to your computer and use it in GitHub Desktop.
transfer.fish: fish function wrapper to transfer.sh
function transfer
if test (count $argv) -eq 0
echo "No arguments specified. Usage:"
echo "transfer /tmp/test.md"
echo "cat /tmp/test.md | transfer test.md"
return 0
end
set tmpfile (mktemp -t transferXXX)
if tty -s
set basefile (basename "$argv[1]" | sed -e 's/[^a-zA-Z0-9._-]/-/g')
curl --progress-bar --upload-file "$argv[1]" "https://transfer.sh/$basefile" >> $tmpfile
else
curl --progress-bar --upload-file "-" "https://transfer.sh/$argv[1]" >> $tmpfile
end
cat $tmpfile
rm -f $tmpfile
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment