lean4-htt/tests/lean/interactive/mk_input.sh
Sebastian Ullrich 67fc899d0d feat(shell/server): sync: default "content" to file content
This mostly simplifies debugging and testing
2018-01-23 11:14:18 -08:00

9 lines
338 B
Bash
Executable file

#!/usr/bin/env bash
# generate server input from "--^" markers
echo "{\"seq_num\": 0, \"command\": \"sync\", \"file_name\": \"$1\"}"
awk '{
i = match($0, /--\^/);
if (i > 0) {
printf("{\"seq_num\": %s, %s, \"file_name\": \"'"$1"'\", \"line\": %s, \"column\": %s}\n", NR, substr($0, i + 4), NR - 1, i + 1);
}
}' < "$1"