github.com/puellanivis/breton@v0.2.16/lib/util/status.go (about) 1 package util 2 3 import ( 4 "fmt" 5 "os" 6 ) 7 8 // CleanLineStart is a string that may be printed which will reset to column 0, and then set ANSI formatting to default. 9 const CleanLineStart = "\r\033[K" 10 11 // Status is a convenience shortcut for fmt.Fprint(os.Stderr, ...) 12 func Status(values ...interface{}) { 13 fmt.Fprint(os.Stderr, values...) 14 } 15 16 // Statusln is a convenience shortcut for fmt.Fprintln(os.Stderr, ...) 17 func Statusln(values ...interface{}) { 18 fmt.Fprintln(os.Stderr, values...) 19 } 20 21 // Statusf is a convenience shortcut for fmt.Fprintf(os.Stderr, format, ...) 22 func Statusf(format string, values ...interface{}) { 23 fmt.Fprintf(os.Stderr, format, values...) 24 } 25 26 // Fatal is a convenience shortcut for fmt.Fprint(os.Stderr, ...) followed by this library's Exit(1). 27 func Fatal(values ...interface{}) { 28 Status(values...) 29 Exit(1) 30 } 31 32 // Fatalln is a convenience shortcut for fmt.Fprintln(os.Stderr, ...) followed by this library's Exit(1). 33 func Fatalln(values ...interface{}) { 34 Statusln(values...) 35 Exit(1) 36 } 37 38 // Fatalf is a convenience shortcut for fmt.Fprintf(os.Stderr, format, ...) followed by this library's Exit(1). 39 func Fatalf(format string, values ...interface{}) { 40 Statusf(format, values...) 41 Exit(1) 42 }