diff --git a/scripts/install-agent.sh b/scripts/install-agent.sh
index ef58507..4d6ccab 100755
--- a/scripts/install-agent.sh
+++ b/scripts/install-agent.sh
@@ -52,9 +52,9 @@ JSON
${PYTHON}
${AGENT}
- serve
--config
${CONFIG}
+ serve
RunAtLoad
@@ -113,7 +113,7 @@ Wants=network-online.target
[Service]
Type=simple
-ExecStart=${PYTHON} ${AGENT} serve --config ${CONFIG}
+ExecStart=${PYTHON} ${AGENT} --config ${CONFIG} serve
Restart=always
RestartSec=5
User=root
diff --git a/src/ollama_swap_agent.py b/src/ollama_swap_agent.py
index fe23d2f..9ddda67 100644
--- a/src/ollama_swap_agent.py
+++ b/src/ollama_swap_agent.py
@@ -501,14 +501,22 @@ def serve(config: Dict[str, Any]) -> None:
def build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(description="ollama-plagin-swap remote agent")
parser.add_argument("--config", help="path to JSON configuration")
+ config_parent = argparse.ArgumentParser(add_help=False)
+ config_parent.add_argument("--config", help="path to JSON configuration")
subparsers = parser.add_subparsers(dest="command")
- subparsers.add_parser("serve", help="run HTTP agent and watcher")
- status_parser = subparsers.add_parser("status", help="print one status report")
+ subparsers.add_parser("serve", parents=[config_parent], help="run HTTP agent and watcher")
+ status_parser = subparsers.add_parser(
+ "status", parents=[config_parent], help="print one status report"
+ )
status_parser.add_argument("--json", action="store_true")
status_parser.add_argument("--dry-run", action="store_true")
- check_parser = subparsers.add_parser("check", help="run one threshold check")
+ check_parser = subparsers.add_parser(
+ "check", parents=[config_parent], help="run one threshold check"
+ )
check_parser.add_argument("--dry-run", action="store_true")
- restart_parser = subparsers.add_parser("restart-now", help="restart ollama service now")
+ restart_parser = subparsers.add_parser(
+ "restart-now", parents=[config_parent], help="restart ollama service now"
+ )
restart_parser.add_argument("--force", action="store_true")
restart_parser.add_argument("--reason", default="manual")
restart_parser.add_argument("--dry-run", action="store_true")