From 3c17198ff1038a5547eb0d7d7c681e15c6eacf02 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Thu, 10 Oct 2019 08:42:32 +0200 Subject: [PATCH] [scripts][editor_cli] Use new beat/beat.cmdline> environment command to update information --- beat/editor/scripts/editor_cli.py | 26 +++++++++++++------------- conda/meta.yaml | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/beat/editor/scripts/editor_cli.py b/beat/editor/scripts/editor_cli.py index 9e46968..cf56c03 100644 --- a/beat/editor/scripts/editor_cli.py +++ b/beat/editor/scripts/editor_cli.py @@ -39,11 +39,10 @@ from click_plugins import with_plugins from PyQt5.QtWidgets import QApplication from PyQt5.QtCore import QCoreApplication -from beat.core.dock import Host - from beat.cmdline.click_helper import AliasedGroup from beat.cmdline.decorators import raise_on_error from beat.cmdline.decorators import verbosity_option +from beat.cmdline import environments from ..utils import setup_logger from ..utils import check_prefix_folders @@ -64,19 +63,13 @@ global logger logger = None -def dump_environments(environments_file_path): - logger.info("Generating environments information") - Host(images_cache=environments_file_path, raise_on_errors=False) - logger.info("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): - dump_environments(environments) + environments_file_path = ctx.meta["environments"] + if not os.path.exists(environments_file_path): + ctx.invoke(environments.list, type_="all", output=environments_file_path) def check_prefix(prefix_path): @@ -194,15 +187,22 @@ Example: @editor.command(epilog=ENV_REFRESH_EPILOG) +@click.option( + "--type", + "-t", + "type_", + type=click.Choice(["docker", "remote", "all"], case_sensitive=False), + default="all", +) @click.pass_context @raise_on_error -def refresh_env(ctx): +def refresh_env(ctx, type_): """Update environments cache""" environments_file_path = ctx.meta["environments"] if os.path.exists(environments_file_path): os.remove(environments_file_path) - dump_environments(environments_file_path) + ctx.invoke(environments.list, type_=type_, output=environments_file_path) @editor.group(cls=AliasedGroup) diff --git a/conda/meta.yaml b/conda/meta.yaml index 6bca39c..93fe340 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -30,7 +30,7 @@ requirements: - click - click-plugins - docopt - - beat.cmdline >=1.5.0b0 + - beat.cmdline >=1.5.1b0 test: requires: -- 2.21.0