From efaa971627fd3f8a403ad51b0946d1b5c4f8a528 Mon Sep 17 00:00:00 2001 From: ismail simsek <6005685+ismailsimsek@users.noreply.github.com> Date: Mon, 3 Mar 2025 11:21:13 +0100 Subject: [PATCH] Minor improve result handling --- opendbt/__main__.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/opendbt/__main__.py b/opendbt/__main__.py index d93041f..5e78134 100644 --- a/opendbt/__main__.py +++ b/opendbt/__main__.py @@ -6,13 +6,22 @@ def main(): - p = argparse.ArgumentParser() - p.add_argument('--project-dir', default=None) - ns, args = p.parse_known_args() - if ns.project_dir is None: - ns.project_dir = os.environ.get('DBT_PROJECT_DIR', Path.cwd()) + parser = argparse.ArgumentParser(description="OpenDBT CLI") + parser.add_argument( + "--project-dir", + default=os.environ.get("DBT_PROJECT_DIR"), + help="Path to the dbt project directory. Defaults to the DBT_PROJECT_DIR environment variable or the current working directory.", + ) + parser.add_argument( + "--profiles-dir", + default=os.environ.get("DBT_PROFILES_DIR"), + help="Path to the dbt profiles directory. Defaults to the DBT_PROFILES_DIR environment variable.", + ) + ns, args = parser.parse_known_args() + project_dir = Path(ns.project_dir) if ns.project_dir else Path.cwd() + profiles_dir = Path(ns.profiles_dir) if ns.profiles_dir else None - OpenDbtCli(project_dir=Path(ns.project_dir)).invoke(args=args) + OpenDbtCli(project_dir=project_dir, profiles_dir=profiles_dir).invoke(args=args) if __name__ == "__main__":