clarkkitchen22's picture
Update geobot/cli.py
e035c40 verified
import argparse
import sys
import subprocess
from pathlib import Path
def run_basic_demo() -> None:
"""
Run the basic usage example (examples/01_basic_usage.py).
"""
# Always resolve project root as the top folder containing /geobot/
project_root = Path(__file__).resolve().parents[1]
examples_dir = project_root / "examples"
script = examples_dir / "01_basic_usage.py"
script = project_root / "examples" / "01_basic_usage.py"
print(f"[GeoBot CLI] Running basic demo: {script}")
sys.exit(
subprocess.run([sys.executable, str(script)], check=False).returncode
)
def run_taiwan_situation_room() -> None:
project_root = Path(__file__).resolve().parents[1]
script = project_root / "examples" / "taiwan_situation_room.py"
if not script.exists():
print(f"[GeoBot CLI] Taiwan demo script not found at: {script}")
sys.exit(1)
print(f"[GeoBot CLI] Launching Taiwan Situation Room: {script}")
sys.exit(subprocess.run([sys.executable, str(script)], check=False).returncode)
def main() -> None:
import subprocess # local import to avoid issues if not used
parser = argparse.ArgumentParser(
prog="geobot",
description="GeoBotv1 CLI - Geopolitical forecasting demos",
)
subparsers = parser.add_subparsers(dest="command", required=True)
# geobot forecast --scenario taiwan
p_forecast = subparsers.add_parser(
"forecast", help="Run a forecasting demo scenario"
)
p_forecast.add_argument(
"--scenario",
type=str,
default="basic",
help="Scenario name (e.g. 'basic', 'taiwan')",
)
args = parser.parse_args()
if args.command == "forecast":
scenario = (args.scenario or "").lower()
if scenario == "taiwan":
run_taiwan_situation_room()
else:
run_basic_demo()
else:
parser.print_help()