mirror of
https://github.com/lllin000/PaperForge.git
synced 2026-07-22 06:50:53 +00:00
20 lines
579 B
Python
20 lines
579 B
Python
"""paperforge.commands.content_discovery — ``paperforge content-discovery`` gateway command."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
|
|
from paperforge.retrieval import gateway
|
|
|
|
|
|
def run(args: argparse.Namespace) -> int:
|
|
"""Execute ``content-discovery`` via the Layer 4 gateway."""
|
|
result = gateway.route_gateway(
|
|
args.vault_path,
|
|
"content-discovery",
|
|
args.query,
|
|
json_mode=args.json,
|
|
limit=getattr(args, "limit", 5),
|
|
)
|
|
print(result.to_json() if args.json else result.data)
|
|
return 0 if result.ok else 1
|