Created
November 14, 2013 16:34
Revisions
-
oparrish created this gist
Nov 14, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ import subprocess import re try: host = clipboard.get_selection() host = host.strip() pattern = re.compile("^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$") validHost = pattern.match(host) if validHost: subprocess.call(['terminator','--new-tab', '-e', 'ssh %s' % host]) window.activate('terminator.Terminator',False,True) else: raise Exception("Invalid host selected") except Exception as e: error_message=str(e) if error_message == "No text found in X selection": error_message = "No host selected" dialog.info_dialog("Error", error_message)