-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathStandardStyle.go
51 lines (40 loc) · 1.09 KB
/
StandardStyle.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
package main
import (
"github.com/inkyblackness/hacker/styling"
"fmt"
"github.com/fatih/color"
)
type standardStyle struct {
prompt styling.StyleFunc
err styling.StyleFunc
status styling.StyleFunc
added styling.StyleFunc
removed styling.StyleFunc
}
func newStandardStyle() *standardStyle {
style := &standardStyle{
prompt: color.New(color.FgGreen).SprintFunc(),
err: color.New(color.FgRed, color.Bold).SprintFunc(),
status: color.New(color.FgCyan).SprintFunc(),
added: color.New(color.FgMagenta, color.Bold).SprintFunc(),
removed: color.New(color.FgCyan, color.Bold).SprintFunc()}
return style
}
func (style *standardStyle) Println(s string) {
fmt.Fprintln(color.Output, s)
}
func (style *standardStyle) Prompt() styling.StyleFunc {
return style.prompt
}
func (style *standardStyle) Error() styling.StyleFunc {
return style.err
}
func (style *standardStyle) Status() styling.StyleFunc {
return style.status
}
func (style *standardStyle) Added() styling.StyleFunc {
return style.added
}
func (style *standardStyle) Removed() styling.StyleFunc {
return style.removed
}