mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-15 00:15:32 +02:00
fix: fix ReplacePlaceholderString
This commit is contained in:
@ -22,9 +22,12 @@ func ResolveTemplate(templateStr string, object interface{}, funcs template.Func
|
||||
|
||||
// ResolvePlaceholderString populates a template with values
|
||||
func ResolvePlaceholderString(str string, arguments map[string]string) string {
|
||||
oldnews := make([]string, 0, len(arguments)*4)
|
||||
for key, value := range arguments {
|
||||
str = strings.Replace(str, "{{"+key+"}}", value, -1)
|
||||
str = strings.Replace(str, "{{."+key+"}}", value, -1)
|
||||
oldnews = append(oldnews,
|
||||
"{{"+key+"}}", value,
|
||||
"{{."+key+"}}", value,
|
||||
)
|
||||
}
|
||||
return str
|
||||
return strings.NewReplacer(oldnews...).Replace(str)
|
||||
}
|
||||
|
Reference in New Issue
Block a user