Skip to content

Commit fcb8666

Browse files
committed
feat: adapt setup-remote.py to account for the new cookiecutter values
1 parent 5704d98 commit fcb8666

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

{{cookiecutter.project_name}}/scripts/setup-remote.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ def main() -> None:
1515
"""Parses command line input and passes it through to setup_git."""
1616
parser: argparse.ArgumentParser = get_parser()
1717
args: argparse.Namespace = parser.parse_args()
18-
setup_remote(path=args.path, github_user=args.github_user, repo_name=args.repo_name)
18+
setup_remote(path=args.path, repository_host=args.repository_host, repository_path=args.repository_path)
1919

2020

21-
def setup_remote(path: Path, github_user: str, repo_name: str) -> None:
21+
def setup_remote(path: Path, repository_host: str, repository_path: str) -> None:
2222
"""Set up the provided cookiecutter-robust-python project's git repo."""
2323
commands: list[list[str]] = [
2424
["git", "fetch", "origin"],
25-
["git", "remote", "add", "origin", f"https://github.com/{github_user}/{repo_name}.git"],
26-
["git", "remote", "set-url", "origin", f"https://github.com/{github_user}/{repo_name}.git"],
25+
["git", "remote", "add", "origin", f"https://{repository_host}/{repository_path}.git"],
26+
["git", "remote", "set-url", "origin", f"https://{repository_host}/{repository_path}.git"],
2727
["git", "pull"],
2828
["git", "checkout", "main"],
2929
["git", "push", "-u", "origin", "main"],
@@ -40,7 +40,7 @@ def get_parser() -> argparse.ArgumentParser:
4040
"""Creates the argument parser for setup-git."""
4141
parser: argparse.ArgumentParser = argparse.ArgumentParser(
4242
prog="setup-git",
43-
usage="python ./scripts/setup-remote.py . -u 56kyle -n robust-python-demo",
43+
usage="python ./scripts/setup-remote.py . -h github.com -p 56kyle/robust-python-demo",
4444
description="Set up the provided cookiecutter-robust-python project's remote repo connection.",
4545
)
4646
parser.add_argument(
@@ -49,8 +49,8 @@ def get_parser() -> argparse.ArgumentParser:
4949
metavar="PATH",
5050
help="Path to the repo's root directory (must already exist).",
5151
)
52-
parser.add_argument("-u", "--user", dest="github_user", help="GitHub user name.")
53-
parser.add_argument("-n", "--name", dest="repo_name", help="Name of the repo.")
52+
parser.add_argument("-h", "--host", dest="repository_host", help="Repository host (e.g., github.com, gitlab.com).")
53+
parser.add_argument("-p", "--path", dest="repository_path", help="Repository path (e.g., user/repo, group/subgroup/repo).")
5454
return parser
5555

5656

0 commit comments

Comments
 (0)