-
Notifications
You must be signed in to change notification settings - Fork 51
/
format.go
41 lines (31 loc) · 628 Bytes
/
format.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
package main
import (
"github.com/reconquest/loreley"
)
type (
outputFormat int
)
const (
outputFormatText outputFormat = iota
outputFormatJSON
)
func parseOutputFormat(
args map[string]interface{},
) outputFormat {
formatType := outputFormatText
if args["--json"].(bool) {
formatType = outputFormatJSON
}
return formatType
}
func parseColorMode(args map[string]interface{}) loreley.ColorizeMode {
switch args["--color"].(string) {
case "always":
return loreley.ColorizeAlways
case "auto":
return loreley.ColorizeOnTTY
case "never":
return loreley.ColorizeNever
}
return loreley.ColorizeNever
}