1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

feat: allow OSCommand.Quote to be invoked within a custom command

This commit is contained in:
Ryooooooga
2022-09-30 21:10:56 +09:00
parent 092363a986
commit 19df238b77
4 changed files with 9 additions and 21 deletions

View File

@ -1,9 +1,6 @@
package custom_commands
import (
"bytes"
"text/template"
"github.com/jesseduffield/lazygit/pkg/common"
"github.com/jesseduffield/lazygit/pkg/config"
)
@ -110,17 +107,3 @@ type CustomCommandObject struct {
PromptResponses []string
Form map[string]string
}
func ResolveTemplate(templateStr string, object interface{}) (string, error) {
tmpl, err := template.New("template").Parse(templateStr)
if err != nil {
return "", err
}
var buf bytes.Buffer
if err := tmpl.Execute(&buf, object); err != nil {
return "", err
}
return buf.String(), nil
}