diff options
author | Wolfy-J <[email protected]> | 2018-06-10 20:31:05 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-06-10 20:31:05 +0300 |
commit | ed3a0f2bb25077c7a32a54ddb3754f04ffbdccf3 (patch) | |
tree | 9a579e6ce81e7af5e3844fbcf590f9c8db26d90a /cmd/rr/utils | |
parent | ade5cc504e2b082d0838cc93c3a185246fdc7834 (diff) |
debug mode have been added
Diffstat (limited to 'cmd/rr/utils')
-rw-r--r-- | cmd/rr/utils/config.go | 26 | ||||
-rw-r--r-- | cmd/rr/utils/cprint.go | 32 |
2 files changed, 0 insertions, 58 deletions
diff --git a/cmd/rr/utils/config.go b/cmd/rr/utils/config.go deleted file mode 100644 index 452dd195..00000000 --- a/cmd/rr/utils/config.go +++ /dev/null @@ -1,26 +0,0 @@ -package utils - -import ( - "github.com/spf13/viper" - "github.com/spiral/roadrunner/service" -) - -// ViperWrapper provides interface bridge between Viper configs and service.Config. -type ViperWrapper struct { - Viper *viper.Viper -} - -// Get nested config section (sub-map), returns nil if section not found. -func (w *ViperWrapper) Get(key string) service.Config { - sub := w.Viper.Sub(key) - if sub == nil { - return nil - } - - return &ViperWrapper{sub} -} - -// Unmarshal unmarshal config data into given struct. -func (w *ViperWrapper) Unmarshal(out interface{}) error { - return w.Viper.Unmarshal(out) -} diff --git a/cmd/rr/utils/cprint.go b/cmd/rr/utils/cprint.go deleted file mode 100644 index f6f828f8..00000000 --- a/cmd/rr/utils/cprint.go +++ /dev/null @@ -1,32 +0,0 @@ -package utils - -import ( - "fmt" - "gopkg.in/AlecAivazis/survey.v1/core" - "regexp" - "strings" -) - -// 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 { - r, err := regexp.Compile(`<([^>]+)>`) - if err != nil { - panic(err) - } - - format = r.ReplaceAllStringFunc(format, func(s string) string { - return fmt.Sprintf(`{{color "%s"}}`, strings.Trim(s, "<>/")) - }) - - out, err := core.RunTemplate(fmt.Sprintf(format, args...), nil) - if err != nil { - panic(err) - } - - return out -} |