First commit

This commit is contained in:
2025-05-12 10:58:23 +02:00
commit 244eb6e099
6 changed files with 210 additions and 0 deletions

63
readme.md Normal file
View File

@@ -0,0 +1,63 @@
Training Database
=================
Toolset for registrering weight training with a focus on ease of registrering from
a command line.
To install, start by creating the database:
```
create database training;
create user 'jakob';
```
Edit `pg_hba.conf` to have 'jakob' access the training database directly:
```
# TYPE DATABASE USER ADDRESS METHOD
local training jakob peer
```
As postgres user, do a config reload:
```
select pg_reload_conf();
```
Then install rust toolchain by rustup.rs -- make and install the binary (I am assuming you have
a `bin` directly in your homedir, that is in your path):
```
cd train-cli
cargo build --release
cp target/release/train-cli $HOME/bin/train
```
Right now the executable is hardcoded with database name `training` and the use
of unix domain socket in `/var/run/postgresql`.
Now training can be invoked with:
```
train squat 3 10 60
```
Which would register squauts, 3 runs of 10 reps of 60kg -- at local time and date. Optionally a
time, date time or rfc3339 timestamp can be specified:
```
train squat 3 10 60 "12:05:00"
train squat 3 10 60 "2025-12-24 18:00:00"
train squat 3 10 60 "2025-12-24T18:00:00+0200"
```
The two former will source missing date and timezone information from the user session, i.e.
type `date` on your commandline to see what you have.
When travelling you might opt for specifying a specific location on the command line, like:
```
TZ=Australia/Sydney train squat 3 10 60
```
Data in the database can be visualized with, for example, Grafana, more info to follow.