build(deps): bump github.com/gookit/config/v2 from 2.2.4 to 2.2.5

Bumps [github.com/gookit/config/v2](https://github.com/gookit/config) from 2.2.4 to 2.2.5.
- [Release notes](https://github.com/gookit/config/releases)
- [Commits](https://github.com/gookit/config/compare/v2.2.4...v2.2.5)

---
updated-dependencies:
- dependency-name: github.com/gookit/config/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot]
2024-01-16 12:57:39 +01:00
committed by Ralf Haferkamp
parent 2253096609
commit 81e000b987
33 changed files with 1028 additions and 626 deletions
-65
View File
@@ -2,12 +2,9 @@
package strutil
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"strings"
"text/template"
"github.com/gookit/goutil/comdef"
)
@@ -92,68 +89,6 @@ func NewReplacer(pairs map[string]string) *strings.Replacer {
return strings.NewReplacer(ss...)
}
// PrettyJSON get pretty Json string
// Deprecated: please use fmtutil.PrettyJSON() or jsonutil.Pretty() instead it
func PrettyJSON(v any) (string, error) {
out, err := json.MarshalIndent(v, "", " ")
return string(out), err
}
var builtInFuncs = template.FuncMap{
// don't escape content
"raw": func(s string) string {
return s
},
"trim": func(s string) string {
return strings.TrimSpace(s)
},
// join strings
"join": func(ss []string, sep string) string {
return strings.Join(ss, sep)
},
// lower first char
"lcFirst": func(s string) string {
return LowerFirst(s)
},
// upper first char
"upFirst": func(s string) string {
return UpperFirst(s)
},
}
// RenderTemplate quickly render text template.
//
// Deprecated: please use textutil.RenderTpl() instead it
func RenderTemplate(input string, data any, fns template.FuncMap, isFile ...bool) string {
return RenderText(input, data, fns, isFile...)
}
// RenderText quickly render text template
//
// Deprecated: please use textutil.RenderTpl() instead it
func RenderText(input string, data any, fns template.FuncMap, isFile ...bool) string {
t := template.New("simple-text")
t.Funcs(builtInFuncs)
// add custom template functions
if len(fns) > 0 {
t.Funcs(fns)
}
if len(isFile) > 0 && isFile[0] {
template.Must(t.ParseFiles(input))
} else {
template.Must(t.Parse(input))
}
// use buffer receive rendered content
buf := new(bytes.Buffer)
if err := t.Execute(buf, data); err != nil {
panic(err)
}
return buf.String()
}
// WrapTag for given string.
func WrapTag(s, tag string) string {
if s == "" {