Search code examples
intellij-ideaxubuntu

IntelliJ: Paste content of a file to hastebin.com


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


Solution

  • 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.