-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathumbra.sh
More file actions
executable file
·37 lines (29 loc) · 765 Bytes
/
Copy pathumbra.sh
File metadata and controls
executable file
·37 lines (29 loc) · 765 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
36
37
#! /bin/sh
set -eu
log_dir=logs
python="${PYTHON:-python3}"
if ! command -v "$python" > /dev/null; then
printf 'Python not found (tried "%s")\n' "$python" >&2
exit 1
fi
log=0
module=UmbraTk
while echo "${1:-}" | grep -E '^(-?-log|-?-text)$' > /dev/null; do
if [ "${1:-}" = -log ] || [ "${1:-}" = --log ]; then
log=1
shift
fi
if [ "${1:-}" = -text ] || [ "${1:-}" = --text ]; then
module=UmbraText
shift
fi
done
if [ "$log" -eq 1 ]; then
log_filename=$(date '+%F-%T%z').log
log_path="$log_dir"/"$log_filename"
mkdir -p "$log_dir"
ln -f -s "$log_filename" "$log_dir"/um.log
"$python" -O -m umbra."$module" "$@" 2>&1 | tee "$log_path"
else
"$python" -O -m umbra."$module" "$@"
fi