This repository was archived by the owner on Apr 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·103 lines (98 loc) · 1.78 KB
/
entrypoint.sh
File metadata and controls
executable file
·103 lines (98 loc) · 1.78 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/sh -eu
root="${root-.}"
quote() {
printf %s\\n "$1" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/'/"
}
while [ -n "${1+x}" ]; do
case "$1" in
-h|-help)
echo "entrypoint.sh: system environment setup script"
echo
echo "Usage: entrypoint.sh [flags] [--] [args]"
echo
echo "Flags:"
echo " -h: print help message"
echo " -v: enable verbose mode"
echo " -t bool: include table of contents"
echo " -i path: path to input file"
echo " -o path: path to output file"
echo " -p title: page title"
echo
exit 0
;;
-v|-verbose)
shift
set -x
;;
-t|-toc)
shift
if [ -z "${1+x}" ]; then
echo "Expected flag argument" >&2
fi
if [ "$1" = true ]; then
toc=--table-of-contents
else
toc=
fi
shift
;;
-i|-input)
shift
if [ -z "${1+x}" ]; then
echo "Expected input file path" >&2
fi
input="$1"
shift
;;
-o|-output)
shift
if [ -z "${1+x}" ]; then
echo "Expected output file path" >&2
fi
output="$1"
shift
;;
-p|-pagetitle)
shift
if [ -z "${1+x}" ]; then
echo "Expected page title" >&2
fi
if [ -n "$1" ]; then
pagetitle=--variable=pagetitle:"$1"
else
pagetitle=
fi
shift
;;
--)
shift
break;
;;
-*)
flag=`quote "$1"`
echo "Unknown option $flag" >&2
exit 1
;;
*)
shift
break
;;
esac
done
if [ -z "${input+x}" -o -z "${output+x}" ]; then
if [ -z "${input+x}" ]; then
echo "Missing input file path" >&2
fi
if [ -z "${output+x}" ]; then
echo "Missing output file path" >&2
fi
exit 1
fi
if [ -n "${toc-}" ]; then
set -- "${toc}" "$@"
fi
if [ -n "${pagetitle-}" ]; then
set -- "${pagetitle}" "$@"
fi
pandoc "$@" --mathjax --template="$root"/template.htm --output="$output" -- "$input"
node "$root"/build.js "$output"