Fix exit command in console interactive mode (#2086)

Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>
This commit is contained in:
boaz0 2024-10-29 12:13:44 +02:00 committed by GitHub
parent 384dc4cb93
commit 810df00376
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -57,12 +57,11 @@ func (c *ConsoleCommand) modeInteractive(session *repl.Session, ui cli.Ui) int {
// brackets we know not to execute the command just yet
fullCommand, openState := consoleState.UpdateState(line)
switch {
case openState > 0:
if openState > 0 {
// here there are open brackets somewhere, so we don't execute it
// as we are in a bracket we update the prompt. we use one . per layer pf brackets
l.SetPrompt(fmt.Sprintf("%s ", strings.Repeat(".", openState)))
default:
} else {
out, exit, diags := session.Handle(fullCommand)
if diags.HasErrors() {
c.showDiagnostics(diags)