6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-12-13 06:37:46 +00:00

Add convenient "config printvalue" command

This commit is contained in:
Régis Behmo 2019-03-18 22:38:13 +01:00
parent bccbd58e20
commit b84b0a6eed
2 changed files with 14 additions and 0 deletions

View File

@ -2,6 +2,7 @@
## Latest
- [Feature] Add convenient `config printvalue` command
- [Feature] Customize docker registry
- [Feature] Load configuration parameters from the system environment
- [Improvement] Automatic environment re-generation after re-configuration

View File

@ -42,6 +42,18 @@ def save(root, silent, set_):
def printroot(root):
click.echo(root)
@click.command(help="Print a configuration value")
@opts.root
@click.argument("key")
def printvalue(root, key):
config = {}
load_current(config, root)
load_defaults(config)
try:
print(config[key])
except KeyError:
raise exceptions.TutorError("Missing configuration value: {}".format(key))
def load(root):
"""
Load configuration, and generate it interactively if the file does not
@ -200,3 +212,4 @@ def config_path(root):
config.add_command(save)
config.add_command(printroot)
config.add_command(printvalue)