- Writing custom git flow scripts - finishing up without extensive testing

This commit is contained in:
Josako
2025-12-11 09:47:19 +01:00
parent fe9fc047ff
commit 2c8347c91b
8 changed files with 389 additions and 24 deletions

View File

@@ -29,6 +29,12 @@ def _build_parser() -> argparse.ArgumentParser:
description="Git Flow helper voor deze repo",
)
parser.add_argument(
"--dry-run",
action="store_true",
help="Toon welke git-commando's uitgevoerd zouden worden, zonder echt te veranderen",
)
subparsers = parser.add_subparsers(dest="command", required=True)
# status
@@ -85,6 +91,11 @@ def _build_parser() -> argparse.ArgumentParser:
nargs="?",
help="Versienummer (bijv. 1.2.0). Laat leeg om af te leiden van de huidige branch of interactief te vragen.",
)
release_finish.add_argument(
"--env",
dest="env",
help="Omgeving voor tagging (bijv. test, staging, production). Laat leeg voor default uit config.",
)
release_finish.set_defaults(func=release_cmd.handle_release_finish)
# hotfix
@@ -101,6 +112,11 @@ def _build_parser() -> argparse.ArgumentParser:
nargs="?",
help="Naam of versie van de hotfix (zonder prefix). Laat leeg om huidige branch te gebruiken.",
)
hotfix_finish.add_argument(
"--env",
dest="env",
help="Omgeving voor tagging (bijv. test, staging, production). Laat leeg voor default uit config.",
)
hotfix_finish.set_defaults(func=hotfix_cmd.handle_hotfix_finish)
return parser
@@ -110,8 +126,6 @@ def main(argv: list[str] | None = None) -> int:
if argv is None:
argv = sys.argv[1:]
cfg.load_config() # voor nu alleen defaults, later evt. bestand
parser = _build_parser()
try:
@@ -119,6 +133,11 @@ def main(argv: list[str] | None = None) -> int:
except SystemExit as exc: # argparse gebruikt SystemExit
return exc.code
# Dry-run vlag doorgeven aan configuratie *voor* we commands uitvoeren
cfg.CONFIG.dry_run = bool(getattr(args, "dry_run", False))
cfg.load_config() # later kan dit config-bestand inladen en overrides toepassen
func = getattr(args, "func", None)
if func is None:
parser.print_help()