-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathload.sh
More file actions
35 lines (27 loc) · 706 Bytes
/
load.sh
File metadata and controls
35 lines (27 loc) · 706 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
set -x;
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
cleanup() {
rv=$?
trap - SIGINT SIGTERM ERR EXIT
echo "Exit code $rv"
exit $rv
}
if [ -z "$1" ]; then
echo "Usage: $0 <thread_id_or_url>"
exit 1
fi
THREAD_INPUT=$1
THREAD_ID=""
# Extract thread ID from URL
if [[ $THREAD_INPUT =~ /status/([0-9]+) ]]; then
THREAD_ID="${BASH_REMATCH[1]}"
else
# Assuming the input is the ID itself if it doesn't match the URL pattern
THREAD_ID="$THREAD_INPUT"
fi
TREE_OUTPUT="app/public/tree_${THREAD_ID}.json"
mkdir -p app/public
python3 load_thread_async.py "$THREAD_INPUT" "$TREE_OUTPUT"
open --background "http://localhost:5000/#${THREAD_ID}"