Created
May 25, 2015 10:20
-
-
Save loverdos/4ad1c46d4b302bf0cfed to your computer and use it in GitHub Desktop.
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 characters
#!/usr/bin/env python | |
from os.path import expanduser | |
from ConfigParser import ConfigParser | |
from sys import argv | |
kamakirc = "%s/.kamakirc" % expanduser("~") | |
cfg=ConfigParser() | |
cfg.read(kamakirc) | |
if len(argv) == 1: | |
print "Usage %s -l" % argv[0] | |
print " to see a listing of all cloud sections in ~/.kamakirc" | |
print "Usage %s --list" % argv[0] | |
print " ditto" | |
print "Usage %s cloud1 cloud2 ... cloudN" % argv[0] | |
print " to read the tokens of the given cloud sections" | |
print " e.g.: %s production" % argv[0] | |
print " to read [cloud \"production\"] section from ~/.kamakirc" | |
elif len(argv) == 2 and (argv[1] == '-l' or argv[1] == '--list'): | |
sections = cfg.sections() | |
for section in sections: | |
if section.startswith('cloud '): | |
print section | |
else: | |
clouds = argv[1:] | |
for cloud in clouds: | |
token = cfg.get('cloud "%s"' % cloud, 'token') | |
print token |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
print token
isprint cloud, token