database := "db/games.rec"

# show all commands
default:
  just -l --unsorted

# how many games played
@played:
  recsel -t Game -e "Role = 'Player'" -P Module -C {{database}}

# how many games ran
@ran:
  recsel -t Game -e "Role = 'DM'" -P Module -C {{database}}

# ongoing
@ongoing:
  recsel -t Game -e 'Status = "Ongoing"' -p System,Module {{database}}

# show all in year
year x:
  recsel -t Game -e 'Updated >> "{{x}}-01-01"' -P "Module,System,Updated" {{database}}

alias n := new
# create a new game
new: cli

alias u := update
# create a new game update
update: cli

# start cli
cli:
  sh bin/cli.sh

# build da html
html:
  sh bin/html.sh

# rss feed
feed:
  sh bin/feed.sh

# copy to blog
export:
  just html && cp dist/index.html ../dozens-and-dragons/out/gamelog/

# DO THE THANG
build: html feed

# upload
up: build export
  rsync -azP --exclude=.git dist/* tilde:public_html/gamelog

# do everything
all: build up