summaryrefslogtreecommitdiff
path: root/cmd/util/cprint.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/util/cprint.go')
-rw-r--r--cmd/util/cprint.go47
1 files changed, 0 insertions, 47 deletions
diff --git a/cmd/util/cprint.go b/cmd/util/cprint.go
deleted file mode 100644
index 3a986fd6..00000000
--- a/cmd/util/cprint.go
+++ /dev/null
@@ -1,47 +0,0 @@
-package util
-
-import (
- "fmt"
- "github.com/mgutz/ansi"
- "os"
- "regexp"
- "strings"
-)
-
-var (
- reg *regexp.Regexp
-
- // Colorize enables colors support.
- Colorize = true
-)
-
-func init() {
- reg, _ = regexp.Compile(`<([^>]+)>`)
-}
-
-// Printf works identically to fmt.Print but adds `<white+hb>color formatting support for CLI</reset>`.
-func Printf(format string, args ...interface{}) {
- fmt.Print(Sprintf(format, args...))
-}
-
-// Sprintf works identically to fmt.Sprintf but adds `<white+hb>color formatting support for CLI</reset>`.
-func Sprintf(format string, args ...interface{}) string {
- format = reg.ReplaceAllStringFunc(format, func(s string) string {
- if !Colorize {
- return ""
- }
-
- return ansi.ColorCode(strings.Trim(s, "<>/"))
- })
-
- return fmt.Sprintf(format, args...)
-}
-
-// Panicf prints `<white+hb>color formatted message to STDERR</reset>`.
-func Panicf(format string, args ...interface{}) error {
- _, err := fmt.Fprint(os.Stderr, Sprintf(format, args...))
- if err != nil {
- return err
- }
- return nil
-}