#!/usr/bin/env bash

while read -r model; do
	# try to sort by 'when', otherwise just merge
	ttally merge "$model" --sort-key when || ttally merge "$model"
done < <(ttally models)

# compress data if on my linux machine
# https://github.com/seanbreckenridge/on_machine
# https://github.com/seanbreckenridge/core/blob/main/shellscripts/json-compress
hash on_machine && hash json-compress && [[ "$(on_machine)" =~ ^linux_* ]] && json-compress -o table "${HPIDATA}/ttally/"*.json
ttally update-cache
