Coverage for src / rhiza / commands / status.py: 100%

16 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-02 07:04 +0000

1"""Command for displaying Rhiza sync status from template.lock. 

2 

3This module provides functionality to read and display the current sync 

4state stored in .rhiza/template.lock. 

5""" 

6 

7from pathlib import Path 

8 

9from loguru import logger 

10 

11from rhiza.commands._sync_helpers import _load_lock_or_warn 

12 

13 

14def status(target: Path) -> None: 

15 """Display the current sync status from template.lock. 

16 

17 Reads .rhiza/template.lock and prints the repository, ref, SHA, 

18 sync timestamp, strategy, and included templates/paths. 

19 

20 Args: 

21 target: Path to the target repository root. 

22 """ 

23 lock = _load_lock_or_warn(target) 

24 if lock is None: 

25 return 

26 logger.info(f"Repository : {lock.host}/{lock.repo}") 

27 logger.info(f"Ref : {lock.ref}") 

28 logger.info(f"SHA : {lock.sha[:12]}") 

29 logger.info(f"Synced at : {lock.synced_at}") 

30 logger.info(f"Strategy : {lock.strategy}") 

31 if lock.templates: 

32 logger.info(f"Templates : {', '.join(lock.templates)}") 

33 elif lock.include: 

34 logger.info(f"Include : {', '.join(lock.include)}")