forked from nathany/looper
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprint.go
50 lines (39 loc) · 1.16 KB
/
print.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
package main
import (
"fmt"
"github.com/koyachi/go-term-ansicolor/ansicolor"
)
func Header() {
fmt.Println(ansicolor.Cyan("Looper 0.3.2 is watching your files"))
fmt.Println("Type " + ansicolor.Magenta("help") + " for help.\n")
}
func DebugEnabled() {
DebugMessage("Debug mode enabled.\n")
}
func DebugMessage(format string, a ...interface{}) {
msg := fmt.Sprintf(format, a...)
fmt.Println(ansicolor.IntenseBlack(msg))
}
func DebugError(msg error) {
fmt.Println(ansicolor.IntenseBlack(msg.Error()))
}
func DisplayHelp() {
fmt.Println(ansicolor.Magenta("\nInteractions:\n"))
fmt.Println(" * a, all Run all tests")
fmt.Println(" * h, help You found it")
fmt.Println(" * e, exit Leave Looper")
}
func PrintWatching(folder string) {
ClearPrompt()
fmt.Println(ansicolor.Yellow("Watching path"), ansicolor.Yellow(folder))
}
func UnknownCommand(command string) {
fmt.Println(ansicolor.Red("ERROR:")+" Unknown command", ansicolor.Magenta(command))
}
const CSI = "\x1b["
// remove from the screen anything that's been typed
// from github.com/kierdavis/ansi
func ClearPrompt() {
fmt.Printf("%s2K", CSI) // clear line
fmt.Printf("%s%dG", CSI, 0) // go to column 0
}