1
Fork 0

View all config

This commit is contained in:
Jake Howard 2015-12-06 15:58:02 +00:00
parent 52f09a481a
commit fd0b12d310
2 changed files with 12 additions and 1 deletions

View file

@ -11,7 +11,11 @@ def cli():
@click.argument('key', nargs=-1) @click.argument('key', nargs=-1)
def show(key): def show(key):
key = " ".join(key) key = " ".join(key)
print(config.get(key)) if not key:
for key, value in config.get_all().items():
print("{}: {}".format(key, value))
return 0
print("'{}' is set to '{}'".format(key, config.get(key)))
return 0 return 0

View file

@ -45,6 +45,13 @@ def get(key):
return None return None
def get_all():
all_config = {}
for key, value in DEFAULT_CONFIG.items():
all_config[key] = get(key)
return all_config
def set(key, value): def set(key, value):
if key not in DEFAULT_CONFIG: if key not in DEFAULT_CONFIG:
return "NO_KEY" return "NO_KEY"