IntelliJ: Paste content of a file to hastebin.com

133 Views Asked by At

I'm searching for a simple way to paste the content of a file directly from IntelliJ into hastebin.

But I didn't find any plugin for IntelliJ. I'm running IntelliJ on Xubuntu 14.12.

Thank you in advance

1

There are 1 best solutions below

0
On BEST ANSWER

Hi we used the following solution provided here: https://github.com/seejohnrun/haste-client

By using a simple Bash Script and External Tools in Intellij.

Bash Script:

#!/bin/bash
hastepost() { a=$(cat); curl -X POST -s -d "$a" hastebin.com/documents | awk -F '"' '{print "hastebin.com/"$4}'; }

url=$(cat $1 | hastepost)
echo $url
xdg-open $url

If you do not need to open the browser when execution is finished just remove the last line of the bash script.

Then create a new External Tool in Intellij with the following parameters:

enter image description here

Where /home/user/Dev/TOOLS/hastebin/hastebin.sh is the path to your bash script.