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>
16 lines
645 B
Bash
Executable File
16 lines
645 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Run an INSERT/UPDATE/DELETE on the ticketing database. Whitelistable command.
|
|
# Usage: sqlite-exec "UPDATE tickets SET status='done' WHERE id=1"
|
|
if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
|
|
echo "Usage: sqlite-exec <SQL>"
|
|
echo ""
|
|
echo "Run an INSERT, UPDATE, or DELETE on the ticketing database."
|
|
echo "Output is JSON: {\"ok\": true, \"affected_rows\": N}"
|
|
echo ""
|
|
echo "Examples:"
|
|
echo " sqlite-exec \"UPDATE tickets SET status='done' WHERE id=42\""
|
|
echo " sqlite-exec \"UPDATE tickets SET assigned_to='stig' WHERE id=844\""
|
|
exit 0
|
|
fi
|
|
exec python3 "$(dirname "$0")/sqlite_connector.py" execute "$@"
|