From 2bdf6433653bdc66621b20f2830ef2d2303bac8e Mon Sep 17 00:00:00 2001 From: Nick Roach Date: Mon, 8 Apr 2024 11:42:21 -0400 Subject: [PATCH] improve err codes, increment version --- pyproject.toml | 2 +- sprocketship/cli.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 75cf4f2..8623d0b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "sprocketship" -version = "0.3.0" +version = "0.4.1" authors = [ { name="Nicklaus Roach", email="nicklausroach@gmail.com" }, ] diff --git a/sprocketship/cli.py b/sprocketship/cli.py index 17b4e20..3a54432 100644 --- a/sprocketship/cli.py +++ b/sprocketship/cli.py @@ -29,6 +29,7 @@ def liftoff(dir, show): configs_with_paths = extract_configs(data["procedures"]) procs = list(itertools.chain(*configs_with_paths.values())) + err = False for proc in procs: try: rendered_proc = create_javascript_stored_procedure( @@ -44,6 +45,7 @@ def liftoff(dir, show): if show: click.echo(rendered_proc) except Exception as e: + err = True msg = click.style(f"{proc['name']} ", fg="red", bold=True) msg += click.style( f"could not be launched into schema ", fg="white", bold=True @@ -54,8 +56,7 @@ def liftoff(dir, show): click.echo(msg) click.echo(e, err=True) click.echo(rendered_proc) - exit(1) - exit(0) + exit(1 if err else 0) @main.command() @@ -73,6 +74,7 @@ def build(dir, target): configs_with_paths = extract_configs(data["procedures"]) procs = list(itertools.chain(*configs_with_paths.values())) + err = False for proc in procs: try: rendered_proc = create_javascript_stored_procedure( @@ -84,9 +86,9 @@ def build(dir, target): msg += click.style(f"successfully built", fg="white", bold=True) click.echo(msg) except Exception as e: + err = True msg = click.style(f"{proc['name']} ", fg="red", bold=True) msg += click.style(f"could not be built", fg="white", bold=True) click.echo(msg) click.echo(e, err=True) - exit(1) - exit(0) + exit(1 if err else 0)