-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
65 lines (60 loc) · 1.51 KB
/
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package main
import (
"bufio"
"fmt"
"io"
"log"
"os"
"github.com/fsuhrau/gopretty/parser"
"github.com/fsuhrau/gopretty/parser/unity"
"github.com/fsuhrau/gopretty/parser/xcode"
)
func main() {
debug := false
if len(os.Args) > 1 {
debug = os.Args[1] == "debug"
}
matcher := make([]parser.ParserInterface, 19)
matcher[0] = xcode.NewInfoParser()
matcher[1] = xcode.NewSigningParser()
matcher[2] = xcode.NewCompileParser()
matcher[3] = xcode.NewStatusParser()
matcher[4] = xcode.NewErrorParser()
matcher[5] = xcode.NewWarningParser()
matcher[6] = xcode.NewLinkerParser()
matcher[7] = xcode.NewPackagingParser()
matcher[8] = xcode.NewTestParser()
matcher[9] = xcode.NewCopyParser()
matcher[10] = xcode.NewPhasesParser()
matcher[11] = unity.NewErrorParser()
matcher[12] = unity.NewWarningParser()
matcher[13] = unity.NewRemoteAssetCacheParser()
matcher[14] = unity.NewScriptCompiledParser()
matcher[15] = unity.NewFinishedILPostProcessor()
matcher[16] = unity.NewImportAssetParser()
matcher[17] = unity.NewBuildProcessParser()
matcher[18] = unity.NewDotEnvParser()
errLogger := log.New(os.Stderr, "", 0)
//logger := log.New(os.Stdout, "", 0)
reader := bufio.NewReader(os.Stdin)
for {
text, err := reader.ReadString('\n')
if err != nil {
if err != io.EOF {
errLogger.Println(err.Error())
os.Exit(1)
}
return
}
matches := false
for _, m := range matcher {
if m.Match(text, reader) {
matches = true
break
}
}
if debug && !matches {
fmt.Printf("NOMA: %s", text)
}
}
}