31 lines
858 B
Python
31 lines
858 B
Python
from __future__ import annotations
|
|
|
|
from ..core import config, git_api, output
|
|
|
|
|
|
def handle_status(args) -> int: # noqa: ARG001 - argparse API
|
|
"""Toon huidige branch en eenvoudige status-info."""
|
|
|
|
try:
|
|
branch = git_api.get_current_branch()
|
|
except git_api.GitError as exc:
|
|
output.error(str(exc))
|
|
return 1
|
|
|
|
clean = git_api.is_clean_working_tree()
|
|
|
|
output.heading("Repo status")
|
|
output.plain(f"Huidige branch : {branch}")
|
|
output.plain(f"Working tree : {'clean' if clean else 'NIET clean'}")
|
|
|
|
# Optionele remote-checks
|
|
cfg = config.CONFIG
|
|
for important_branch in {cfg.main_branch, cfg.develop_branch, branch}:
|
|
try:
|
|
git_api.ensure_not_behind_remote(important_branch, cfg.remote_name)
|
|
except git_api.GitError as exc:
|
|
output.warning(str(exc))
|
|
|
|
return 0
|
|
|