From 3f4d60c8bbeda2ca0d7cf3a28dbfcc428911e800 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Sun, 19 Apr 2026 11:52:22 +0200 Subject: [PATCH] feat(tooling): add --help/-h to sqlite-query and sqlite-exec (#722) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tooling/db/sqlite-exec | 11 +++++++++++ tooling/db/sqlite-query | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/tooling/db/sqlite-exec b/tooling/db/sqlite-exec index 5dfe9cb87..ba3174b7d 100755 --- a/tooling/db/sqlite-exec +++ b/tooling/db/sqlite-exec @@ -1,4 +1,15 @@ #!/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 " + 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 "$@" diff --git a/tooling/db/sqlite-query b/tooling/db/sqlite-query index f217bc0ee..460fe0e39 100755 --- a/tooling/db/sqlite-query +++ b/tooling/db/sqlite-query @@ -1,4 +1,15 @@ #!/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 " + 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 "$@"