Skip to content

Instantly share code, notes, and snippets.

@mduvall
Last active December 19, 2015 12:59
Show Gist options
  • Save mduvall/5958673 to your computer and use it in GitHub Desktop.
Save mduvall/5958673 to your computer and use it in GitHub Desktop.
Ghetto SCP on sublime using subprocess
import sublime, sublime_plugin
import os
import tempfile
import subprocess
class SCPOnSave(sublime_plugin.EventListener):
def on_post_save(self, view):
folder_name, file_name = os.path.split(view.file_name())
file_path = folder_name + '/' + file_name
command = 'scp ' + file_path + ' <URL HERE>:' + file_path + ' > /dev/null'
# view.window().run_command API on SL3 is undocumented for args
# show_output looks like it's deprecated and gone...using subprocess here
# so that panel won't open.
subprocess.call(command, shell=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment