Commit e6f38685 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[scripts][editor_cli] Move environment cache update in option

This allows for not calling the update process when --help is
passed and allow more fine grained control of which sub command
does it. For example, it doesn't make sense to create the cash
if the refresh_env sub-command is called.
parent 1a5a2f29
...@@ -62,6 +62,25 @@ def dump_environments(environments_file_path): ...@@ -62,6 +62,25 @@ def dump_environments(environments_file_path):"Done")"Done")
def setup_environment_cache(ctx, param, value):
"""Click option callback to setup environment cache"""
if not value:
environments = ctx.meta["environments"]
if not os.path.exists(environments):
refresh_environment_cache_flag = click.option(
help="Do not check for environment cache",
Example: Example:
$ beat editor start $ beat editor start
...@@ -95,9 +114,6 @@ def editor(ctx, environments): ...@@ -95,9 +114,6 @@ def editor(ctx, environments):
logger = setup_logger("beat.editor", ctx.meta["verbosity"]) logger = setup_logger("beat.editor", ctx.meta["verbosity"])"BEAT prefix set to `%s'", ctx.meta["config"].path)"BEAT prefix set to `%s'", ctx.meta["config"].path)
if not os.path.exists(environments):
QCoreApplication.setApplicationName("beat.editor") QCoreApplication.setApplicationName("beat.editor")
QCoreApplication.setOrganizationName("Idiap") QCoreApplication.setOrganizationName("Idiap")
QCoreApplication.setOrganizationDomain("ch.idiap") QCoreApplication.setOrganizationDomain("ch.idiap")
...@@ -106,6 +122,7 @@ def editor(ctx, environments): ...@@ -106,6 +122,7 @@ def editor(ctx, environments):
@editor.command(epilog=START_EPILOG) @editor.command(epilog=START_EPILOG)
@click.pass_context @click.pass_context
@raise_on_error @raise_on_error
def start(ctx): def start(ctx):
"""Start the beat editor""" """Start the beat editor"""
...@@ -130,6 +147,7 @@ Example: ...@@ -130,6 +147,7 @@ Example:
@click.argument("asset_type") @click.argument("asset_type")
@click.argument("asset_name") @click.argument("asset_name")
@click.pass_context @click.pass_context
@raise_on_error @raise_on_error
def edit(ctx, asset_type, asset_name): def edit(ctx, asset_type, asset_name):
"""Edit one specific asset""" """Edit one specific asset"""
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment