#!/usr/bin/env bash
# tool/changelog -- what changed in this build
set -o pipefail
SELF=$(readlink -f "${BASH_SOURCE[0]}")
NV_BASE=$(cd "$(dirname "$SELF")/../../.." && pwd)
export NV_BASE
# shellcheck source=/dev/null
. "$NV_BASE/lib/core/bootstrap.sh"

ui_header "$(t tool_m_changelog)" "v$(cat "$NV_BASE/VERSION" 2>/dev/null)"

for f in "$NV_BASE/docs/CHANGELOG.md" /usr/share/doc/nhanhvps/CHANGELOG.md; do
    if [ -r "$f" ]; then
        sed -n '1,80p' "$f" | sed 's/^/  /'
        ui_blank
        exit 0
    fi
done
ui_info "$(t chlog_missing)"
exit 0
