Skip to content

Commit 064741d

Browse files
committed
Add prefix flag to syntax benchmark script
1 parent f8c1510 commit 064741d

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

clj/bin/syntime

+16-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,22 @@
44
# Distributed under the MIT license.
55
# http://www.opensource.org/licenses/mit-license.php
66

7-
if (($# != 1)); then
8-
echo "usage: $0 file.clj"
7+
abort_with_help() {
8+
echo "usage: $(basename "$0") [-p PREFIX] file.clj"
99
exit 1
10-
fi
10+
}
11+
12+
PREFIX='report'
13+
14+
while getopts :p: opt; do
15+
case "$opt" in
16+
p) PREFIX="$OPTARG";;
17+
h) abort_with_help;;
18+
esac
19+
done
20+
shift $((OPTIND-1))
21+
22+
(($# == 1)) || abort_with_help
1123

1224
VIMRC="
1325
set runtimepath^=$(dirname "$0")/../..
@@ -17,6 +29,6 @@ syntime on
1729
"
1830

1931
exec vim -N -u <(echo "$VIMRC") \
20-
-c 'execute "redir > " . strftime("report-%Y-%m-%d-%H-%M-%S.log")' \
32+
-c "execute 'redir > ' . strftime('${PREFIX}-$(date +%s.%N).log')" \
2133
-c 'call feedkeys(repeat("j", line("$")-1) . ":silent syntime report | quit\<CR>")' \
2234
"$1"

0 commit comments

Comments
 (0)