-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
51 lines (41 loc) · 845 Bytes
/
main.go
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
package main
import (
"csclub-activities/cmd"
"csclub-activities/lesson"
"csclub-activities/util"
"errors"
"io"
"os"
)
func main() {
if len(os.Args) > 1 {
cmd.Execute()
return
}
information, err := util.Load()
if err != nil {
if errors.Is(err, io.EOF) { // no file created
err = util.NewSave()
if err != nil {
util.LogErrorAndExit(err)
}
cmd.Execute()
return
} else {
util.LogErrorAndExit(err)
}
}
if information.LessonId == util.NoOngoingActivity {
cmd.Execute()
return
}
err = lesson.Master.Run(int(information.LessonId), int(information.CheckpointID), false)
if err != nil {
util.LogErrorAndExit(err)
}
// commands during lesson
// stop -> clears checkpoint
// previous -> sets checkpoint to previous one + does thing
// help ->
// active checkpoint? || stop || previous
}