From d0e6c921f18af32dc1d12b2b7dee308b0e0d9bea Mon Sep 17 00:00:00 2001 From: Jakub Czajka Date: Sun, 17 Dec 2023 22:08:10 +0100 Subject: [PATCH] Add the main script for interacting with the gym database. --- gym.sh | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100755 gym.sh diff --git a/gym.sh b/gym.sh new file mode 100755 index 0000000..b2f3d1f --- /dev/null +++ b/gym.sh @@ -0,0 +1,101 @@ +#!/bin/sh +# Copyright (c) 2023 Jakub Czajka +# License: GPL-3.0 or later. + +. /etc/environment + +gyms=$(/usr/bin/psql --user=gym_tracker --dbname="${GYM_DB}" --tuples-only \ + --no-align --command="SELECT name FROM gyms") + +format_as() { + xargs --replace={} echo "${1}" +} + +PAGE=" + + + + + + +
+
+ New workout + + +
+
+ +
+
+ New exercise + + +
+
+ +
+
+ New gym + + +
+
+ +" + +echo "HTTP/1.1 200 OK" +echo "Content-Type: text/html" +echo "${PAGE}" | sed 's/^[ \t]*//g' -- 2.39.5