View all config
This commit is contained in:
parent
52f09a481a
commit
fd0b12d310
2 changed files with 12 additions and 1 deletions
|
@ -11,7 +11,11 @@ def cli():
|
|||
@click.argument('key', nargs=-1)
|
||||
def show(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
|
||||
|
||||
|
||||
|
|
|
@ -45,6 +45,13 @@ def get(key):
|
|||
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):
|
||||
if key not in DEFAULT_CONFIG:
|
||||
return "NO_KEY"
|
||||
|
|
Reference in a new issue