74 lines
3.2 KiB
Bash
Executable File
74 lines
3.2 KiB
Bash
Executable File
#!/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=(
|
||
# starts with origin then school
|
||
# "Handbooks/Player_handbook_vky -o int -o stat -o spe -o sec -o sec- -o sec-r -o sec-b -o sec-a -o sec-t -o cre -o reg -o sym"
|
||
"Handbooks/Player_handbook_vky -o stat -o spe -o int -o sec -o sec- -o sec-r -o sec-b -o sec-a -o sec-t -o cre -o reg -o sym"
|
||
"Handbooks/Player_handbook_dst -o origines_stats -o art -o int -o sec -o sec- -o sec-r -o sec-b -o sec-a -o sec-t -o cre -o reg -o sym"
|
||
"Handbooks/Player_handbook_dur -o origines_stats_handbook_yenui_2 -o mag -o int -o sec -o sec- -o sec-r -o sec-b -o sec-a -o sec-t -o cre -o reg -o sym"
|
||
"Handbooks/Player_handbook_grg -o origines_stats_handbook_yenui_1 -o gue -o int -o sec -o sec- -o sec-r -o sec-b -o sec-a -o sec-t -o cre -o reg -o sym"
|
||
"Handbooks/Player_handbook_ily -o origines_stats_handbook_treant_1 -o ein -o int -o sec -o sec- -o sec-r -o sec-b -o sec-a -o sec-t -o cre -o reg -o sym"
|
||
"Handbooks/Player_handbook_llo -o origines_stats_handbook_fenrir_2 -o lan -o int -o sec -o sec- -o sec-r -o sec-b -o sec-a -o sec-t -o cre -o reg -o sym"
|
||
"Handbooks/Player_handbook_wul -o origines_stats_handbook_fenrir_1 -o mai -o int -o sec -o sec- -o sec-r -o sec-b -o sec-a -o sec-t -o cre -o reg -o sym"
|
||
# 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!"
|