-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.go
More file actions
49 lines (37 loc) · 920 Bytes
/
example.go
File metadata and controls
49 lines (37 loc) · 920 Bytes
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
package main
import (
"fmt"
"log"
"github.com/loganmac/process"
)
func main() {
driver := &Summarizer{}
processor := process.New(driver)
driver.PrintHeader("Setting up concert")
wrapErr(processor.Run("Preparing show", "./test-scripts/noisy-good.sh"))
wrapErr(processor.Run("Setting up stage", "./test-scripts/good-with-warn.sh"))
driver.PrintHeader("Let the show begin")
wrapErr(processor.Run("Opening gates", "./test-scripts/good.sh"))
wrapErr(processor.Run("Starting show", "./test-scripts/bad.sh"))
wrapErr(processor.Run("Shouldn't run", "./test-scripts/good.sh"))
}
func wrapErr(e error) {
if e != nil {
log.Fatal(e)
}
}
func clear(s string) string {
return fmt.Sprintf("\033[2K%s", s)
}
func clearLine() {
fmt.Print("\033[2K")
}
func printClearLine() {
fmt.Println("\033[2K")
}
func cursorUp(n int) {
fmt.Printf("\033[%dA", n)
}
func cursorDown(n int) {
fmt.Printf("\033[%dB", n)
}