diff --git a/tools/appslib/get_apps_repo.py b/tools/appslib/get_apps_repo.py index 21675657e0..c8094a161e 100644 --- a/tools/appslib/get_apps_repo.py +++ b/tools/appslib/get_apps_repo.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import os import argparse import tempfile import logging @@ -19,10 +20,13 @@ def __init__(self, *args, **kwargs): def add_args(parser: argparse.ArgumentParser, required: bool = False) -> None: + env_apps_dir_str = os.environ.get("YNH_APPS_DIR") + env_apps_dir = Path(env_apps_dir_str) if env_apps_dir_str is not None else None + repo_group = parser.add_mutually_exclusive_group(required=required) repo_group.add_argument("-c", "--apps-repo", type=str, default=DEFAULT_GIT_REPO, help="Git url to clone the 'apps' repository") - repo_group.add_argument("-d", "--apps-dir", type=Path, help="Path to an existing 'apps' repository") + repo_group.add_argument("-d", "--apps-dir", type=Path, help="Path to an existing 'apps' repository", default=env_apps_dir) def from_args(args: argparse.Namespace) -> Path: