1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-21 00:30:00 +02:00

Support match colors in labelFormat entry in menuFromCommand prompts

This commit is contained in:
Elwardi
2021-08-07 16:06:36 +01:00
parent 5d1a9639b6
commit b5d8849c06
4 changed files with 29 additions and 20 deletions

View File

@ -136,7 +136,12 @@ func (gui *Gui) GenerateMenuCandidates(commandOutput, filter, valueFormat, label
return nil, gui.surfaceError(errors.New("unable to parse value format, error: " + err.Error()))
}
descTemp, err := template.New("format").Parse(labelFormat)
colorFuncMap := template.FuncMap{}
for k, v := range style.ColorMap {
colorFuncMap[k] = v.Foreground.Sprint
}
descTemp, err := template.New("format").Funcs(colorFuncMap).Parse(labelFormat)
if err != nil {
return nil, gui.surfaceError(errors.New("unable to parse label format, error: " + err.Error()))
}