This repository has been archived on 2026-08-30. You can view files and clone it, but cannot push or open issues or pull requests.
Ravenous-LaTeX/all_players.sh

67 lines
2.1 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# -------------------------------------------------------------
# build_and_rename.sh
#
# Usage:
# ./build_and_rename.sh [any extra options]
#
# Every positional argument you give here will be appended
# (verbatim) after the entry‑specific options when invoking
# `./build.sh`.
# -------------------------------------------------------------
set -euo pipefail # Fail fast, treat unset variables as errors
####################################
## 1. Configuration (inline)
####################################
rm -rf Handbooks
mkdir -p Handbooks
entries=(
"Handbooks/Player_handbook_eduald -o origines_stats_handbook_abyssal_1"
"Handbooks/Player_handbook_michel -o fra"
# Add more lines like above as needed
)
####################################
## 2. Forwarded arguments
####################################
# All arguments that the user typed after the script name.
wrapper_opts=("$@") # Empty array if no args were given.
####################################
## 3. Main loop – process each entry
####################################
for entry in "${entries[@]}"; do
# Split entry into:
# * $output_name – first word (everything before the first space)
# * $options – everything after that first word
output_name="${entry%% *}" # text before first space
options="${entry#$output_name }" # text after that space
echo "=== Building for '$output_name' ==="
echo " entry options : ${options}"
echo " wrapper opts : ${wrapper_opts[*]}"
# Run the real build script.
#
# - `player` is fixed before any options
# - `$options` expands into its constituent arguments (unquoted)
# - `"${wrapper_opts[@]}"` appends whatever the user typed after
# this wrapper script, *verbatim*.
./build.sh "${wrapper_opts[@]}" player $options
# The build step is expected to produce a file named:
# Player_handbook_build.pdf
# (adjust if your build writes somewhere else).
mv -f Player_handbook_build.pdf "${output_name}.pdf"
echo "'${output_name}.pdf' created."
done
echo
echo "All entries processed successfully!"