mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-23 12:18:51 +02:00
Better format error catching in menuFromCommand prompts
This commit is contained in:
parent
b92ff3ee3f
commit
f70435a20f
@ -185,7 +185,10 @@ func (gui *Gui) handleCustomCommandKeybinding(customCommand config.CustomCommand
|
|||||||
// Need to make a menu out of what the cmd has displayed
|
// Need to make a menu out of what the cmd has displayed
|
||||||
candidates := []string{}
|
candidates := []string{}
|
||||||
buff := bytes.NewBuffer(nil)
|
buff := bytes.NewBuffer(nil)
|
||||||
temp := template.Must(template.New("format").Parse(prompt.Format))
|
temp, err := template.New("format").Parse(prompt.Format)
|
||||||
|
if err != nil {
|
||||||
|
return gui.surfaceError(errors.New("unable to parse format, error: " + err.Error()))
|
||||||
|
}
|
||||||
for _, str := range strings.Split(string(message), "\n") {
|
for _, str := range strings.Split(string(message), "\n") {
|
||||||
if str == "" {
|
if str == "" {
|
||||||
continue
|
continue
|
||||||
@ -203,7 +206,11 @@ func (gui *Gui) handleCustomCommandKeybinding(customCommand config.CustomCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
temp.Execute(buff, tmplData)
|
err = temp.Execute(buff, tmplData)
|
||||||
|
if err != nil {
|
||||||
|
return gui.surfaceError(err)
|
||||||
|
}
|
||||||
|
|
||||||
candidates = append(candidates, strings.TrimSpace(buff.String()))
|
candidates = append(candidates, strings.TrimSpace(buff.String()))
|
||||||
buff.Reset()
|
buff.Reset()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user