summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2025-04-30 10:47:54 +0200
committerTor Andersson <tor@ccxvii.net>2025-04-30 17:50:37 +0200
commitef6892fd6a3c95d7076b0e707f20f38430d8948b (patch)
tree11c8aaa3978ea7a4f91b2f7b8d1913e4384680a6
parentb22ca94f482ce9374c92d4fd58d83f9f174a5cb9 (diff)
downloadserver-ef6892fd6a3c95d7076b0e707f20f38430d8948b.tar.gz
Improve rtt-show commands.HEADmaster
rtt show GAME [ JSON-PATH ] rtt show-snap GAME [ SNAP [ JSON-PATH ] ] For example: rtt show 123 active rtt show 123 undo rtt show 123 hand[0]
-rwxr-xr-xbin/rtt-foreach2
-rwxr-xr-xbin/rtt-help3
-rwxr-xr-xbin/rtt-show10
-rwxr-xr-xbin/rtt-show-game7
-rwxr-xr-xbin/rtt-show-snap5
5 files changed, 18 insertions, 9 deletions
diff --git a/bin/rtt-foreach b/bin/rtt-foreach
index 22feb77..268d64b 100755
--- a/bin/rtt-foreach
+++ b/bin/rtt-foreach
@@ -8,6 +8,7 @@ fi
for M in $(sqlite3 db "select title_id from titles")
do
+ echo
echo "Entering 'public/$M'"
if pushd public/$M >/dev/null
then
@@ -15,3 +16,4 @@ do
popd >/dev/null
fi
done
+echo
diff --git a/bin/rtt-help b/bin/rtt-help
index 57e42d1..74209a1 100755
--- a/bin/rtt-help
+++ b/bin/rtt-help
@@ -19,9 +19,10 @@ module development
fuzz-rand -- fuzz test a module (random)
game debugging
+ show -- show game state
show-chat -- show game chat (for moderation)
- show-game -- show game state object
show-replay -- show game replay log
+ show-snap -- show game rewind snapshot
miscellaneous tools
update-covers -- generate cover thumbnails
diff --git a/bin/rtt-show b/bin/rtt-show
new file mode 100755
index 0000000..b643a8c
--- /dev/null
+++ b/bin/rtt-show
@@ -0,0 +1,10 @@
+#!/bin/bash
+if [ "$#" = 1 ]
+then
+ sqlite3 db "select json_remove(json_remove(state, '$.undo'), '$.log') from game_state where game_id = $1"
+elif [ "$#" = 2 ]
+then
+ sqlite3 db "select state -> '$.$2' from game_state where game_id = $1"
+else
+ echo "usage: rtt-show GAME [ JSON-PATH ]"
+fi
diff --git a/bin/rtt-show-game b/bin/rtt-show-game
deleted file mode 100755
index f055449..0000000
--- a/bin/rtt-show-game
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-if [ -n "$1" ]
-then
- sqlite3 db "select json_remove(json_remove(state, '$.undo'), '$.log') from game_state where game_id = $1"
-else
- echo "usage: rtt-show-game GAME"
-fi
diff --git a/bin/rtt-show-snap b/bin/rtt-show-snap
index af744a7..8116d48 100755
--- a/bin/rtt-show-snap
+++ b/bin/rtt-show-snap
@@ -5,6 +5,9 @@ then
elif [ $# -eq 2 ]
then
sqlite3 -column db "select state from game_snap where game_id=$1 and snap_id=$2"
+elif [ $# -eq 3 ]
+then
+ sqlite3 -column db "select state -> '$.$3' from game_snap where game_id=$1 and snap_id=$2"
else
- echo "usage: rtt-show-snap GAME"
+ echo "usage: rtt-show-snap GAME [ SNAP [ JSON-PATH ] ]"
fi