Last active
January 2, 2016 16:59
-
-
Save olesku/8334285 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sublime, sublime_plugin, os | |
class ScpOnSave(sublime_plugin.EventListener): | |
def on_post_save(self, view): | |
remoteFolders = [ | |
[ "/home/oles/Code/project", "oles@skudsvik.no:~/www/project" ] | |
] | |
fileName = view.file_name() | |
for remoteFolder in remoteFolders: | |
if fileName.startswith(remoteFolder[0]): | |
myFile = fileName[len(remoteFolder[0]):] | |
remoteFile = remoteFolder[1] + myFile | |
scpCmd = "/usr/bin/scp %s %s" % ( fileName, remoteFile ) | |
os.system(scpCmd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment