#!/usr/bin/env bash # Run a SELECT query on the ticketing database. Whitelistable command. # Usage: sqlite-query "SELECT * FROM tickets WHERE status='in_progress'" if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then echo "Usage: sqlite-query " >&2 echo "" >&2 echo "Run a SELECT query on the ticketing database." >&2 echo "Output is JSON: {\"ok\": true, \"count\": N, \"rows\": [...]}" >&2 echo "" >&2 echo "Examples:" >&2 echo " sqlite-query \"SELECT id, title, status FROM tickets WHERE sprint_id=36\"" >&2 echo " sqlite-query \"SELECT * FROM tickets WHERE assigned_to='stig'\"" >&2 exit 0 fi exec python3 "$(dirname "$0")/sqlite_connector.py" query "$@"