#!/usr/bin/env bash

set -euo pipefail
# set -x

KEYTEXT="Press ENTER to continue to the next question..."
TERM_WIDTH=$(tput cols)
for (( i = 1; i <= $(ls -l *.txt | wc -l); i++ )); do
	if [ ${i} -eq 15 ]; then
		KEYTEXT="You are done with the review! Press ENTER to QUIT."
	fi
	clear
	cat ${i}.txt
	read -n 1 -s -r -p "$(printf "\n\n%*s\n" $(( (${#KEYTEXT} + TERM_WIDTH) / 2 )) "$KEYTEXT")"
	# echo -e "Question ${i}:\n" > $i.txt
done
