-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
39 lines (33 loc) · 805 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
package main
import (
"bufio"
"os"
)
func main() {
// parse command line arguments and populate op, res, params, and flags
initializeArgs()
// set up file handle for results
if *output != "" {
fo, err := os.Create(*output)
if err != nil {
log.Critical("%s", err)
}
defer func() {
if err := fo.Close(); err != nil {
log.Critical("%s", err)
}
}()
outfile = bufio.NewWriter(fo)
} else {
outfile = bufio.NewWriter(os.Stdout)
}
defer outfile.Flush()
// set up logging and initialize log
initializeLogger()
// parse config file and populate env data structure
initializeConfig()
// bundle up the request into a data structure that can be easily marshaled
createJSONRequest()
// POST the request to the api, receive the results, and process them
postRequest()
}