|
3 | 3 | import os |
4 | 4 | import sys |
5 | 5 | import subprocess |
| 6 | + |
6 | 7 | from . import __version__ as deploy_version |
7 | 8 | from .lib.bootstrap import logger |
| 9 | +from .lib.utils import print_unicode_box, BorderColor |
8 | 10 | from .cmd.build import StackQLProvisioner |
9 | 11 | from .cmd.test import StackQLTestRunner |
10 | 12 | from .cmd.teardown import StackQLDeProvisioner |
|
16 | 18 | # utility functions |
17 | 19 | # |
18 | 20 |
|
19 | | -def print_unicode_box(message): |
20 | | - border_color = '\033[93m' # Yellow color |
21 | | - reset_color = '\033[0m' |
22 | | - |
23 | | - lines = message.split('\n') |
24 | | - max_length = max(len(line) for line in lines) |
25 | | - top_border = border_color + '┌' + '─' * (max_length + 2) + '┐' + reset_color |
26 | | - bottom_border = border_color + '└' + '─' * (max_length + 2) + '┘' + reset_color |
27 | | - |
28 | | - click.echo(top_border) |
29 | | - for line in lines: |
30 | | - click.echo(border_color + '│ ' + line.ljust(max_length) + ' │' + reset_color) |
31 | | - click.echo(bottom_border) |
32 | | - |
33 | 21 | def get_stackql_instance(custom_registry=None, download_dir=None): |
34 | 22 | """Initializes StackQL with the given options.""" |
35 | 23 | stackql_kwargs = {} |
@@ -190,7 +178,7 @@ def build(ctx, stack_dir, stack_env, log_level, env_file, |
190 | 178 | ) |
191 | 179 | message = (f"Deploying stack: [{stack_name_display}] " |
192 | 180 | f"to environment: [{stack_env}]") |
193 | | - print_unicode_box(message) |
| 181 | + print_unicode_box(message, BorderColor.YELLOW) |
194 | 182 |
|
195 | 183 | provisioner.run(dry_run, show_queries, on_failure) |
196 | 184 | click.echo("🎯 dry-run build complete" if dry_run |
@@ -222,7 +210,7 @@ def teardown(ctx, stack_dir, stack_env, log_level, env_file, |
222 | 210 | ) |
223 | 211 | message = (f"Tearing down stack: [{stack_name_display}] " |
224 | 212 | f"in environment: [{stack_env}]") |
225 | | - print_unicode_box(message) |
| 213 | + print_unicode_box(message, BorderColor.YELLOW) |
226 | 214 |
|
227 | 215 | deprovisioner.run(dry_run, show_queries, on_failure) |
228 | 216 | click.echo(f"🚧 teardown complete (dry run: {dry_run})") |
@@ -253,7 +241,7 @@ def test(ctx, stack_dir, stack_env, log_level, env_file, |
253 | 241 | ) |
254 | 242 | message = (f"Testing stack: [{stack_name_display}] " |
255 | 243 | f"in environment: [{stack_env}]") |
256 | | - print_unicode_box(message) |
| 244 | + print_unicode_box(message, BorderColor.YELLOW) |
257 | 245 |
|
258 | 246 | test_runner.run(dry_run, show_queries, on_failure) |
259 | 247 | click.echo(f"🔍 tests complete (dry run: {dry_run})") |
|
0 commit comments