[Script] Uploading Arduino Sketches from an SSH console

The short version:
Included is a script that burns compiled sketches (.hex files) to the 32u4 from a shell session on the Yun itself.
Basic *nix commandline skills are required. Documentation is included with the program, run with -h or --help.

Download the latest version here.

The long version:
hex-upload was born of a desire to get the Arduino IDE to upload sketches to my Yun over the network, and add proxy support in the process. The entire protocol is encrypted (over ssh), and left me few options for lying about the IP address the Arduino is located at.
Even if you could manually specify an IP address, I still wondered what commands were called to burn the sketch to the Yun's Leonardo.

Downloading the (poorly documented) arduino source code revealed the following code from lines 125-129 in
app/src/cc/arduino/packages/uploaders/SSHUploader.java (commit 0b72c88b42f558692d909f8dcf329ee1e2cb36ae)

    String additionalParams = verbose ? prefs.get("upload.params.verbose") : prefs.get("upload.params.quiet");

    boolean success = ssh.execSyncCommand("merge-sketch-with-bootloader.lua /tmp/sketch.hex", System.out, System.err);
    success = success && ssh.execSyncCommand("run-avrdude /tmp/sketch.hex '" + additionalParams + "'", System.out, System.err);

With this in hand, creating the script was fairly trivial, though some of the features were rather tedious to add.
Of course, you'll need a .hex file to flash. There are many ways to do this, some more complex than others, but we can get the Arduino IDE to do all of the hard work for us. Just follow my illustrated 5 steps to success and you'll be uploading programs from the commandlike like a real hacker.

Step 1: Configure the Arduino IDE for the Arduino Yun. The IP address does not matter. Next, bring up the "File" menu.

Step 2: Open the Preferences window from the File menu.

Step 3: Make sure that you have the box next to "Show Verbose output During" labeled "compilation" checked.

Step 4: Click the "Verify" button to compile your code.

Step 5: Look at the last line or two of output in the lower window to find the .hex file. Track it down and get it onto your arduino via USB, SD card, scp, wget, however you fancy.

Complete downloads list:
GitHub page - here
Version 0.3 - link

Well done!