diff --git a/backend_addon/hooks/pre_prompt.py b/backend_addon/hooks/pre_prompt.py index e78c17e..964f158 100644 --- a/backend_addon/hooks/pre_prompt.py +++ b/backend_addon/hooks/pre_prompt.py @@ -20,7 +20,7 @@ ] -def sanity_check() -> bool: +def sanity_check() -> data.SanityCheckResults: """Run sanity checks on the system.""" checks = [ data.SanityCheck( @@ -31,8 +31,7 @@ def sanity_check() -> bool: ), data.SanityCheck("git", commands.check_command_is_available, ["git"], "error"), ] - result = sanity.run_sanity_checks(checks) - return result.status + return sanity.run_sanity_checks(checks) def main(): @@ -41,8 +40,17 @@ def main(): print("This template should be run with cookieplone") sys.exit(1) - console.panel(title="Plone Addon", msg="Creating a new Plone Addon") - if not sanity_check(): + msg = """ +Creating a new Plone Addon + +Sanity check results: +""" + check_results = sanity_check() + for check in check_results.checks: + label = "green" if check.status else "red" + msg = f"{msg}\n - {check.name}: [{label}]{check.message}[/{label}]" + console.panel(title="Plone Addon", msg=f"{msg}\n") + if not check_results.status: sys.exit(1) diff --git a/project/hooks/pre_prompt.py b/project/hooks/pre_prompt.py index 857e592..d0cd030 100644 --- a/project/hooks/pre_prompt.py +++ b/project/hooks/pre_prompt.py @@ -16,7 +16,7 @@ ] -def sanity_check() -> bool: +def sanity_check() -> data.SanityCheckResults: """Run sanity checks on the system.""" checks = [ data.SanityCheck( @@ -36,8 +36,7 @@ def sanity_check() -> bool: "Docker", commands.check_docker_version, ["docker"], "warning" ), ] - result = sanity.run_sanity_checks(checks) - return result.status + return sanity.run_sanity_checks(checks) def main(): @@ -46,8 +45,17 @@ def main(): print("This template should be run with cookieplone") sys.exit(1) - console.panel(title="Plone Project", msg="Creating a new Plone Project") - if not sanity_check(): + msg = """ +Creating a new Plone Project + +Sanity check results: +""" + check_results = sanity_check() + for check in check_results.checks: + label = "green" if check.status else "red" + msg = f"{msg}\n - {check.name}: [{label}]{check.message}[/{label}]" + console.panel(title="Plone Project", msg=f"{msg}\n") + if not check_results.status: sys.exit(1)