26 lines
1.1 KiB
Bash
26 lines
1.1 KiB
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
# Bundle the user guide into the binary's source tree, for `luxe docs`.
|
||
|
|
#
|
||
|
|
# `docs/guide/` is the one source of the guide. A published crate carries only its own directory, so
|
||
|
|
# `cargo install luxe-cli` would have no guide to show; this writes every page into one file inside
|
||
|
|
# `luxe-cli`, which `luxe docs` embeds. The `guide_check` test fails when the bundle and the guide
|
||
|
|
# disagree, so run this after editing a page.
|
||
|
|
#
|
||
|
|
# scripts/guide-bundle.sh # write crates/luxe-cli/src/guide.md
|
||
|
|
set -euo pipefail
|
||
|
|
# byte order, so the bundle does not depend on the locale it was written in
|
||
|
|
export LC_ALL=C
|
||
|
|
|
||
|
|
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||
|
|
out="${repo_root}/crates/luxe-cli/src/guide.md"
|
||
|
|
|
||
|
|
{
|
||
|
|
printf '%s\n' '<!-- Generated by scripts/guide-bundle.sh from docs/guide/. Edit the guide, not this file. -->'
|
||
|
|
for page in "${repo_root}"/docs/guide/*.md; do
|
||
|
|
printf '@@@ page: %s\n' "$(basename "${page}" .md)"
|
||
|
|
cat "${page}"
|
||
|
|
done
|
||
|
|
} >"${out}"
|
||
|
|
|
||
|
|
echo "bundled $(ls "${repo_root}"/docs/guide/*.md | wc -l) pages into ${out#"${repo_root}/"}"
|