aboutsummaryrefslogtreecommitdiff
path: root/justfile
blob: b67c6f8055e008e4219e2b2c5bdb5e6a44c470c6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
DB := "fun.db"

setup: reset-db

run file *args:
  sqlite3 "{{DB}}" {{args}} < "{{file}}"

image file *args:
  #!/usr/bin/env sh
  set -eu
  image_id=$(just run "{{file}}" {{args}})
  just show-image "$image_id"

show-image image_id:
  #!/usr/bin/env sh
  echo "Displaying $image_id" 1>&2
  ./image.sh {{image_id}} | magick display -

repl *args:
  rlwrap sqlite3 "{{DB}}" {{args}}

reset-db:
  rm "{{DB}}"
  sqlite3 "{{DB}}" < setup.sql