-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_gleam.sh
More file actions
executable file
·52 lines (38 loc) · 987 Bytes
/
Copy pathsetup_gleam.sh
File metadata and controls
executable file
·52 lines (38 loc) · 987 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
printf -v day "%02d" $2
gleam_file="gleam/src/year${1}/day${day}.gleam"
gleam_code="import gleam/int
import gleam/list
import args.{type Part, PartOne, PartTwo}
import util
pub fn main(input: String, part: Part) -> String {
case part {
PartOne -> \"0\"
PartTwo -> \"0\"
}
}"
test_file="gleam/test/year${1}/day${day}_test.gleam"
test_code="import gleeunit
import gleeunit/should
import args.{PartOne, PartTwo}
import year${1}/day${day}
const example = \"\"
pub fn main() {
gleeunit.main()
}
pub fn part_one_test() {
example |> day${day}.main(PartOne) |> should.equal(\"0\")
}
pub fn part_two_test() {
example |> day${day}.main(PartTwo) |> should.equal(\"0\")
}"
mkdir -p "inputs/${1}"
mkdir -p "gleam/src/year${1}"
mkdir -p "gleam/test/year${1}"
if [ ! -f "${gleam_file}" ]; then
echo "creating src and test for year${1}/day${day}"
touch $gleam_file
echo "$gleam_code" > $gleam_file
touch $test_file
echo "$test_code" > $test_file
fi