Skip to content

Commit

Permalink
allow skipping login
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos committed May 20, 2024
1 parent c127001 commit 9f3e208
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
23 changes: 22 additions & 1 deletion .submodules/recurse-fork/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import re
import subprocess
import typing as t
from argparse import ArgumentParser, Namespace
from dataclasses import dataclass
from pathlib import Path
from subprocess import CalledProcessError
Expand All @@ -27,6 +28,23 @@ class Submodule:
url: str


def get_namespace() -> Namespace:
"""Get the command line values passed to this script.
Returns:
An object containing all the command line values.
"""
arg_parser = ArgumentParser()
arg_parser.add_argument(
"--skip-login",
action="store_true",
dest="skip_login",
default=False,
)

return arg_parser.parse_args()


def read_submodules() -> t.Dict[str, Submodule]:
"""Read the submodules from .gitmodules (located at the workspace's root).
Expand Down Expand Up @@ -152,9 +170,12 @@ def main() -> None:
"""Entry point."""
colorama_init()

namespace = get_namespace()

submodules = read_submodules()

login_to_github()
if not namespace.skip_login:
login_to_github()

for name, submodule in submodules.items():
fork_repo(name, submodule.url)
Expand Down
2 changes: 1 addition & 1 deletion .submodules/recurse-fork/run
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ cd "${BASH_SOURCE%/*}"

pipenv install --dev

pipenv run python .
pipenv run python . "$@"

0 comments on commit 9f3e208

Please sign in to comment.