-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
46 lines (37 loc) · 784 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
package main
import (
"fmt"
"log"
"os"
"sync"
"github.com/imega/graphql-tester/cmd"
"github.com/imega/graphql-tester/tester"
"github.com/imega/graphql-tester/tester/lexer"
_ "github.com/imega/graphql-tester/tester/lexer/condition"
)
func main() {
cmd.Execute()
wg := sync.WaitGroup{}
buf := make(chan tester.MessageCh)
wg.Add(1)
go func() {
defer wg.Done()
tester.PrinterWatch(buf)
}()
opts := tester.Options{
URL: cmd.Options.URL,
Headers: cmd.Options.Headers,
Path: cmd.Options.Path,
StdOut: buf,
Verbose: cmd.Options.Verbosity,
}
scan, err := lexer.Compile()
if err != nil {
log.Fatalf("err: %s", err)
}
if err := tester.RunNew(opts, scan); err != nil {
fmt.Printf("failed to run tester, %s", err)
}
wg.Wait()
os.Exit(0)
}