-
Notifications
You must be signed in to change notification settings - Fork 4
/
air.go
34 lines (30 loc) · 951 Bytes
/
air.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
package checks
import (
"context"
"strings"
"projectforge.dev/projectforge/app/doctor"
"projectforge.dev/projectforge/app/util"
)
var Air = &doctor.Check{
Key: "air",
Section: "build",
Title: "Air",
Summary: "Used to recompile the project when files change",
URL: "https://github.com/cosmtrek/air",
UsedBy: "[bin/dev.sh]",
Platforms: []string{"!windows"},
Core: true,
Fn: simpleOut(".", "air", []string{"--help"}, func(_ context.Context, r *doctor.Result, out string) *doctor.Result {
if strings.Contains(out, "Command 'air' not found") {
return r.WithError(doctor.NewError("missing", "[air] is not present on your computer"))
}
return r
}),
Solve: solveAir,
}
func solveAir(_ context.Context, r *doctor.Result, _ util.Logger) *doctor.Result {
if r.Errors.Find("missing") != nil || r.Errors.Find("exitcode") != nil {
r.AddSolution("!go install github.com/cosmtrek/air@latest")
}
return r
}