Files
settled-reach/tooling/db/sqlite-query
T
jpmschweitzerandClaude Opus 4.6 3f4d60c8bb feat(tooling): add --help/-h to sqlite-query and sqlite-exec (#722)
Both wrappers previously silently treated --help as a SQL comment and
returned empty result JSON. They now intercept --help/-h before
delegating to the Python connector and print proper usage text with
the correct JSON key names (affected_rows, not rows_affected).

ticket, sprint, and decision already supported --help — no change.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-19 11:52:22 +02:00

16 lines
646 B
Bash
Executable File

#!/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 <SQL>"
echo ""
echo "Run a SELECT query on the ticketing database."
echo "Output is JSON: {\"ok\": true, \"count\": N, \"rows\": [...]}"
echo ""
echo "Examples:"
echo " sqlite-query \"SELECT id, title, status FROM tickets WHERE sprint_id=36\""
echo " sqlite-query \"SELECT * FROM tickets WHERE assigned_to='stig'\""
exit 0
fi
exec python3 "$(dirname "$0")/sqlite_connector.py" query "$@"