mirror of https://github.com/Hilbis/Hilbish
fix: return previous input on continue input error
this is basically 72973eade7
but it actually works and doesnt break everything
if an error occurred with the ContinuePrompt function (in this case,
the error is simply EOL/ctrl d) then return previous input alone
pull/61/head
parent
03b98bdd26
commit
5b03b3cef4
5
main.go
5
main.go
|
@ -183,13 +183,14 @@ func main() {
|
|||
func ContinuePrompt(prev string) (string, error) {
|
||||
hooks.Em.Emit("multiline", nil)
|
||||
lr.SetPrompt(multilinePrompt)
|
||||
|
||||
cont, err := lr.Read()
|
||||
if err != nil {
|
||||
fmt.Println("")
|
||||
return "", err
|
||||
return prev, err
|
||||
}
|
||||
cont = strings.TrimSpace(cont)
|
||||
|
||||
cont = strings.TrimSpace(cont)
|
||||
return prev + strings.TrimSuffix(cont, "\n"), nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue