diff --git a/bench/bench.py b/bench/bench.py index 70934efd6..ede4bedd8 100644 --- a/bench/bench.py +++ b/bench/bench.py @@ -28,7 +28,7 @@ get_venv_path, get_env_cmd, ) -from bench.utils.render import step +from bench.utils.render import job, step if TYPE_CHECKING: @@ -320,7 +320,7 @@ def __get_installed_apps(self) -> List: apps.insert(0, "frappe") return apps - @step(title="Setting Up Bench Dependencies", success="Bench Dependencies Set Up") + @job(title="Setting Up Bench Dependencies", success="Bench Dependencies Set Up") def requirements(self): """Install and upgrade all installed apps on given Bench """ @@ -331,6 +331,7 @@ def requirements(self): self.pip() print(f"Installing {len(apps)} applications...") + for app in apps: App(app, bench=self.bench, to_clone=False).install() diff --git a/bench/cli.py b/bench/cli.py index 844d64b9e..b2eeac136 100755 --- a/bench/cli.py +++ b/bench/cli.py @@ -31,17 +31,16 @@ # these variables are used to show dynamic outputs on the terminal dynamic_feed = False verbose = False +is_envvar_warn_set = None +from_command_line = False # set when commands are executed via the CLI bench.LOG_BUFFER = [] -# set when commands are executed via the CLI -from_command_line = False - change_uid_msg = "You should not run this command as root" src = os.path.dirname(__file__) def cli(): - global from_command_line, bench_config + global from_command_line, bench_config, is_envvar_warn_set from_command_line = True command = " ".join(sys.argv) diff --git a/bench/utils/cli.py b/bench/utils/cli.py index 1c664b25c..7749e00f9 100644 --- a/bench/utils/cli.py +++ b/bench/utils/cli.py @@ -8,6 +8,7 @@ def print_bench_version(ctx, param, value): return import bench + click.echo(bench.VERSION) ctx.exit() @@ -22,7 +23,7 @@ def add_command(self, cmd, name=None): """ name = name or cmd.name if name is None: - raise TypeError('Command has no name.') + raise TypeError("Command has no name.") _check_multicommand(self, name, cmd, register=True) try: @@ -36,18 +37,34 @@ def add_command(self, cmd, name=None): def use_experimental_feature(ctx, param, value): if not value: return + if value == "dynamic-feed": import bench.cli + bench.cli.dynamic_feed = True bench.cli.verbose = True else: from bench.exceptions import FeatureDoesNotExistError + raise FeatureDoesNotExistError(f"Feature {value} does not exist") + from bench.cli import is_envvar_warn_set + + if is_envvar_warn_set: + return + + click.secho( + "WARNING: bench is using it's new CLI rendering engine. This behaviour has" + f" been enabled by passing --{value} in the command. This feature is" + " experimental and may not be implemented for all commands yet.", + fg="yellow", + ) + def setup_verbosity(ctx, param, value): if not value: return import bench.cli + bench.cli.verbose = True