From efdd5636142e80103a393bc59d66bcef9a058faa Mon Sep 17 00:00:00 2001 From: Suraj Date: Sat, 23 May 2026 10:07:31 +0000 Subject: [PATCH] fix: allow --help to work without database connection Skip the test_db_connection and test_connection decorators when --help is passed. This allows users to run 'collectoss --help' and 'collectoss --help' without requiring a database connection, which is useful for getting help during initial setup. Fixes #194 Signed-off-by: Suraj --- collectoss/application/cli/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/collectoss/application/cli/__init__.py b/collectoss/application/cli/__init__.py index 8081d6a8e..aebd93fa1 100644 --- a/collectoss/application/cli/__init__.py +++ b/collectoss/application/cli/__init__.py @@ -39,6 +39,9 @@ def check_connectivity(urls=["http://chaoss.community", "http://github.com", "ht def test_connection(function_internet_connection): @click.pass_context def new_func(ctx, *args, **kwargs): + # Skip connectivity check for --help + if ctx.params.get('help'): + return ctx.invoke(function_internet_connection, *args, **kwargs) usage = re.search(r"Usage:\s(.*)\s\[OPTIONS\]", str(ctx.get_usage())).groups()[0] if not check_connectivity(): print( @@ -57,6 +60,9 @@ def new_func(ctx, *args, **kwargs): def test_db_connection(function_db_connection): @click.pass_context def new_func(ctx, *args, **kwargs): + # Skip DB check for --help since help should work without database + if ctx.params.get('help'): + return ctx.invoke(function_db_connection, *args, **kwargs) engine = DatabaseEngine().engine usage = re.search(r"Usage:\s(.*)\s\[OPTIONS\]", str(ctx.get_usage())).groups()[0] try: