docmachine-containers/utils/docs/build_metadata.sh

34 lines
464 B
Bash
Raw Normal View History

2024-12-11 22:14:25 +01:00
#!/bin/sh
set -ue
MKDOCS_YML_FILE="${1:-}"
OUTPUT_FILE="${2:-}"
gx_usage() {
echo "Usage: $0 <mkdocs_yml_file> <output_file>"
echo ""
}
if [ -z "$MKDOCS_YML_FILE" ]; then
gx_usage
exit 1
fi
if [ -z "$OUTPUT_FILE" ]; then
gx_usage
exit 1
fi
TITLE="$(yq -r '.site_name' < "$MKDOCS_YML_FILE")"
AUTHOR="$(yq -r '.site_author' < "$MKDOCS_YML_FILE")"
cat > "$OUTPUT_FILE" <<-MARK
---
title: Formation
subtitle: "$TITLE"
author: "$AUTHOR"
date: \today
MARK