#!/usr/bin/env bash set -euo pipefail ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # shellcheck source=/dev/null source "${ROOT_DIR}/src/app_v2.sh" usage() { cat <&2 exit 2 fi app_init cmd="$1" shift case "${cmd}" in startup-check) app_startup_checks ;; ingest) if [[ $# -ne 1 ]]; then echo "usage: $0 ingest PAYLOAD_JSON" >&2 exit 2 fi app_ingest_batch "$1" ;; sync-once) app_sync_once ;; sync-loop) app_sync_loop ;; retrieve) if [[ $# -lt 1 || $# -gt 2 ]]; then echo "usage: $0 retrieve ROOTS_CSV [GOAL_PREDICATES_CSV]" >&2 exit 2 fi app_retrieve_with_fallback "$1" "${2:-}" ;; tombstone) if [[ $# -ne 1 ]]; then echo "usage: $0 tombstone EDGE_REF" >&2 exit 2 fi app_tombstone_edge "$1" ;; *) usage >&2 exit 2 ;; esac