-
Notifications
You must be signed in to change notification settings - Fork 1
/
Putty.ipy
27 lines (21 loc) · 977 Bytes
/
Putty.ipy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from Microsoft.Win32 import Registry
from System.Diagnostics import Debug, Process
class Putty(BaseIronPythonCommand):
def __init__(self):
sessionsKey = Registry.CurrentUser.OpenSubKey(r"Software\SimonTatham\PuTTY\Sessions")
self.sessionNames = sessionsKey.GetSubKeyNames()
for name in self.sessionNames:
Debug.Write("Got %s" % name)
def AutoComplete(self, str):
if str.strip() == "": return "putty "
result = filter(lambda x: x.startswith(str), self.sessionNames)
if len(result) > 0: return "putty "+result[0]
result = filter(lambda x: str in x, self.sessionNames)
if len(result) > 0: return "putty "+result[0]
else: return "putty "+str
def Execute(self, args):
Debug.Write("execute: "+args)
if args.strip() == "":
Process.Start("putty.exe")
else:
Process.Start("putty.exe", "-load "+ args)