Files
novelmaster/noma/scripts/status_reporter.py
T
2026-06-23 20:29:02 +08:00

46 lines
1.2 KiB
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Status Reporter
Reports the current status of the novel project.
"""
import argparse
import json
import sys
from pathlib import Path
try:
from runtime_compat import enable_windows_utf8_stdio
except ImportError:
enable_windows_utf8_stdio = lambda: None
def main():
if __name__ == "__main__":
enable_windows_utf8_stdio()
parser = argparse.ArgumentParser(description="Report project status")
parser.add_argument("--project-root", type=str, default=".", help="Project root")
args = parser.parse_args()
project_root = Path(args.project_root).resolve()
# Load state
state_file = project_root / ".noma" / "state.json"
if state_file.exists():
state = json.loads(state_file.read_text(encoding="utf-8"))
print(f"Title: {state.get('title', 'Unknown')}")
print(f"Author: {state.get('author', 'Unknown')}")
print(f"Genre: {state.get('genre', 'Unknown')}")
print(f"Target Words: {state.get('target_words', 0):,}")
print(f"Target Chapters: {state.get('target_chapters', 0)}")
else:
print("No state.json found")
sys.exit(1)
if __name__ == "__main__":
main()