Refactor AI daily report pipeline
This commit is contained in:
40
ai_daily_report/cli.py
Normal file
40
ai_daily_report/cli.py
Normal file
@@ -0,0 +1,40 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
from .runner import run_daily_report
|
||||
|
||||
|
||||
def build_parser() -> argparse.ArgumentParser:
|
||||
parser = argparse.ArgumentParser(prog="ai-daily-report")
|
||||
subcommands = parser.add_subparsers(dest="command")
|
||||
run = subcommands.add_parser("run")
|
||||
run.add_argument("--date", default="today")
|
||||
run.add_argument("--mode", choices=["dry-run", "draft", "publish"], default="dry-run")
|
||||
run.add_argument("--source-mode", choices=["mock", "live"], default="mock")
|
||||
run.add_argument("--llm-mode", choices=["mock", "live"], default="mock")
|
||||
run.add_argument("--out-dir", default="runs")
|
||||
run.add_argument("--base-url", default="https://blog.ephron.ren")
|
||||
run.add_argument("--sources-path", default=None)
|
||||
return parser
|
||||
|
||||
|
||||
def main(argv: list[str] | None = None) -> int:
|
||||
parser = build_parser()
|
||||
args = parser.parse_args(argv)
|
||||
if args.command == "run":
|
||||
run_daily_report(
|
||||
run_date=args.date,
|
||||
mode=args.mode,
|
||||
source_mode=args.source_mode,
|
||||
llm_mode=args.llm_mode,
|
||||
out_dir=Path(args.out_dir),
|
||||
base_url=args.base_url,
|
||||
sources_path=Path(args.sources_path) if args.sources_path else None,
|
||||
)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user