mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-09-26 19:18:02 -05:00
feat(scrape): sync GUI bridge doc into linux-x64 folder
Add sync-gui-bridge-doc.sh to copy the versioned bridge markdown beside the GUI zip; includes offline smoke test (18 total via run-all-smokes).
This commit is contained in:
63
scripts/sync-gui-bridge-doc.sh
Executable file
63
scripts/sync-gui-bridge-doc.sh
Executable file
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -Eeuo pipefail
|
||||
|
||||
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)
|
||||
REPO_ROOT="${DCE_REPO_ROOT:-$(cd "$SCRIPT_DIR/.." && pwd -P)}"
|
||||
SOURCE_DOC="$REPO_ROOT/docs/gui-zip-recurring-scrape-bridge.md"
|
||||
DEFAULT_DEST="$REPO_ROOT/../DiscordChatExporter.linux-x64/RECURRING-SCRAPE.md"
|
||||
DEST_PATH="${DCE_GUI_BRIDGE_DEST:-$DEFAULT_DEST}"
|
||||
DRY_RUN=0
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
Usage:
|
||||
$(basename "$0") [--dest PATH] [--dry-run]
|
||||
|
||||
Copy the versioned GUI zip quick-start from docs/gui-zip-recurring-scrape-bridge.md
|
||||
to the sibling GUI folder (default: ../DiscordChatExporter.linux-x64/RECURRING-SCRAPE.md).
|
||||
EOF
|
||||
}
|
||||
|
||||
die() {
|
||||
printf 'ERROR: %s\n' "$*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
main() {
|
||||
while (($#)); do
|
||||
case "$1" in
|
||||
--dest)
|
||||
[[ $# -ge 2 ]] || die "Missing value for --dest."
|
||||
DEST_PATH=$2
|
||||
shift 2
|
||||
;;
|
||||
--dry-run)
|
||||
DRY_RUN=1
|
||||
shift
|
||||
;;
|
||||
--help|-h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
die "Unknown option: $1"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
[[ -f "$SOURCE_DOC" ]] || die "Missing source doc: $SOURCE_DOC"
|
||||
local dest_dir
|
||||
dest_dir=$(dirname "$DEST_PATH")
|
||||
[[ -d "$dest_dir" ]] || die "Destination directory does not exist: $dest_dir (create it or pass --dest)"
|
||||
|
||||
if (( DRY_RUN == 1 )); then
|
||||
printf 'Would copy:\n %s\n -> %s\n' "$SOURCE_DOC" "$DEST_PATH"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
cp -f "$SOURCE_DOC" "$DEST_PATH"
|
||||
printf 'Synced GUI bridge doc to %s\n' "$DEST_PATH"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
21
scripts/tests/sync-gui-bridge-doc-smoke.sh
Executable file
21
scripts/tests/sync-gui-bridge-doc-smoke.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -Eeuo pipefail
|
||||
|
||||
REPO_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)
|
||||
SYNC="$REPO_ROOT/scripts/sync-gui-bridge-doc.sh"
|
||||
TMP_DIR=$(mktemp -d "${TMPDIR:-/tmp}/dce-bridge-sync-smoke.XXXXXX")
|
||||
DEST="$TMP_DIR/gui-zip/RECURRING-SCRAPE.md"
|
||||
|
||||
cleanup() {
|
||||
rm -rf "$TMP_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
mkdir -p "$TMP_DIR/gui-zip"
|
||||
|
||||
"$SYNC" --dest "$DEST"
|
||||
[[ -f "$DEST" ]] || { printf 'ERROR: dest missing\n' >&2; exit 1; }
|
||||
grep -q 'operator-handoff' "$DEST" || { printf 'ERROR: dest content unexpected\n' >&2; exit 1; }
|
||||
|
||||
printf 'sync-gui-bridge-doc-smoke: ok\n'
|
||||
Reference in New Issue
Block a user