cloudflare/pint

Public

mirrored from https://github.com/cloudflare/pintAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v0.1.4

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

internal/output/output.go

49lines · modecode

1package output
2
3import (
4 "fmt"
5 "io"
6
7 "github.com/fatih/color"
8)
9
10var (
11 redColor = color.New(color.FgRed)
12 blueColor = color.New(color.FgCyan)
13 whiteColor = color.New(color.FgWhite)
14 yellowColor = color.New(color.FgYellow)
15 magnetaColor = color.New(color.FgMagenta)
16 grayColor = color.New(color.FgHiBlack)
17)
18
19func Info(output io.Writer, msg string) {
20 fmt.Fprintln(output, msg)
21}
22
23func Error(output io.Writer, err error) {
24 redColor.Fprintln(output, err.Error())
25}
26
27func MakeRed(format string, a ...interface{}) string {
28 return redColor.Sprintf(format, a...)
29}
30
31func MakeBlue(format string, a ...interface{}) string {
32 return blueColor.Sprintf(format, a...)
33}
34
35func MakeWhite(format string, a ...interface{}) string {
36 return whiteColor.Sprintf(format, a...)
37}
38
39func MakeYellow(format string, a ...interface{}) string {
40 return yellowColor.Sprintf(format, a...)
41}
42
43func MakeMagneta(format string, a ...interface{}) string {
44 return magnetaColor.Sprintf(format, a...)
45}
46
47func MakeGray(format string, a ...interface{}) string {
48 return grayColor.Sprintf(format, a...)
49}
50