Created
January 25, 2012 17:46
-
-
Save tantalor/1677548 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 thor | |
thor.ssh() |
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 sys | |
class Thor: | |
def get_host(self): | |
arg = sys.argv[1] | |
if arg in Thor.hosts: | |
return Thor.hosts[arg] | |
else: | |
raise KeyError("Unknown host") | |
## user defined crap | |
Thor.hosts = { | |
'foo': 'foo.example.com', | |
'bar': 'bar.example.com' | |
} | |
class ssh(Thor): | |
def __init__(self): | |
host = self.get_host() | |
print "host is %s" % host | |
print "implement me" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment