Skip to content

Commit bc2a39f

Browse files
committed
WIP
1 parent f1b02d7 commit bc2a39f

2 files changed

Lines changed: 22 additions & 13 deletions

File tree

src/dotctl/actions/status.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,29 @@ class StatusProps:
2626

2727
def render_full(report: StatusReport):
2828

29-
print("✔ repo: up to date" if report.repo_clean else "⚠ repo: drift detected")
29+
system_in_sync = len(report.modified_files) == 0 and len(report.missing_files) == 0
3030

31-
print(
32-
f"⚠ local changes detected: {len(report.modified_files)} files"
33-
if report.modified_files
34-
else "✔ local changes detected: none"
35-
)
31+
print("✔ system: in sync" if system_in_sync else "⚠ system: drift detected")
32+
33+
if report.modified_files:
34+
print(f"⚠ modified files: {len(report.modified_files)}")
35+
else:
36+
print("✔ modified files: none")
37+
38+
if report.missing_files:
39+
print(f"⚠ missing files: {len(report.missing_files)}")
40+
else:
41+
print("✔ missing files: none")
42+
43+
print("✔ symlink health: OK") # placeholder
44+
print("✔ config validation: passed") # placeholder
3645

37-
print("✔ symlink health: OK")
38-
print("✔ config validation: passed")
3946
print()
4047

41-
if report.modified_files:
48+
if report.modified_files or report.missing_files:
4249
print("Changed files:")
43-
for f in report.modified_files:
50+
51+
for f in report.modified_files + report.missing_files:
4452
print(f" - {f.path}")
4553

4654

@@ -82,7 +90,7 @@ def status(props: StatusProps) -> None:
8290
return
8391

8492
config = conf_reader(config_file=Path(app_config_file))
85-
report = build_status_report(props, config, repo)
93+
report = build_status_report(props.profile_dir, config)
8694

8795
if props.json:
8896
render_json(report)

src/dotctl/handlers/profile_handler.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from pathlib import Path
55
import json
66

7+
from dotctl.handlers.config_handler import Config
78
from dotctl.handlers.diff_handler import get_file_diff
89

910

@@ -53,7 +54,7 @@ def get_state(source: Path, repo_file: Path) -> FileState:
5354
return FileState.SYNCED
5455

5556

56-
def build_status_report(props, config, repo) -> StatusReport:
57+
def build_status_report(profile_dir: Path, config: Config) -> StatusReport:
5758

5859
results: list[StatusEntry] = []
5960

@@ -62,7 +63,7 @@ def build_status_report(props, config, repo) -> StatusReport:
6263
for entry in section.entries:
6364

6465
source = Path(section.location) / entry
65-
repo_file = props.profile_dir / name / entry
66+
repo_file = profile_dir / name / entry
6667

6768
state = get_state(source, repo_file)
6869

0 commit comments

Comments
 (0)