aboutsummaryrefslogtreecommitdiff
path: root/captain/sql/scan_instructions.sh
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2021-03-30 15:09:09 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2021-03-30 15:09:09 -0400
commitc6a3bdfc5e02b9e35b1e0fc5af2d0bf0319681ac (patch)
treee9714d50e2be010557992708ad92aa93522d3daa /captain/sql/scan_instructions.sh
parent8da227ca130355332fc92935cfbabc87bd0db078 (diff)
downloadlevitating-c6a3bdfc5e02b9e35b1e0fc5af2d0bf0319681ac.tar.gz
levitating-c6a3bdfc5e02b9e35b1e0fc5af2d0bf0319681ac.zip
Added script to scan and load instructions. Instructions now displayed on a page.
Diffstat (limited to 'captain/sql/scan_instructions.sh')
-rwxr-xr-xcaptain/sql/scan_instructions.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/captain/sql/scan_instructions.sh b/captain/sql/scan_instructions.sh
new file mode 100755
index 0000000..dab98b3
--- /dev/null
+++ b/captain/sql/scan_instructions.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+cmds=`tempfile`
+echo $cmds
+
+for filename in $2/*.json; do
+ # In case it doesn't exist
+ [ -e "$filename" ] || continue
+ name=${filename##*/}
+ echo $name
+ base=${name%.json}
+ echo $base
+
+ echo "INSERT OR IGNORE INTO instructions(name) VALUES('$base');" | cat >> $cmds
+done
+
+sqlite3 $1 < $cmds
+
+rm $cmds