mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
Fix CLI "exit" command
When we added a line feed to the user input, we broke the check for "exit" (because after that change we were getting "exit\n". This commit moves the exit check before the line feed append.
This commit is contained in:
parent
ceb91cff51
commit
cfbfee031b
1 changed files with 9 additions and 9 deletions
18
cli/cli.go
18
cli/cli.go
|
|
@ -11,11 +11,11 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/chzyer/readline"
|
||||
"github.com/jedib0t/go-pretty/table"
|
||||
"github.com/jedib0t/go-pretty/text"
|
||||
featurebase "github.com/featurebasedb/featurebase/v3"
|
||||
"github.com/featurebasedb/featurebase/v3/cli/fbcloud"
|
||||
"github.com/featurebasedb/featurebase/v3/logger"
|
||||
"github.com/jedib0t/go-pretty/table"
|
||||
"github.com/jedib0t/go-pretty/text"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
|
|
@ -292,6 +292,13 @@ func (cmd *CLICommand) Run(ctx context.Context) error {
|
|||
return errors.Wrap(err, "reading line")
|
||||
}
|
||||
|
||||
if !inMidCommand {
|
||||
// Handle the exit command.
|
||||
if line == exitCommand || line == exitCommand+terminationChar {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// We append a line feed at the end of each line because at this point
|
||||
// we have effectively stripped any intentional line feeds (since we are
|
||||
// reading a line at a time), and we don't want to do that. An example
|
||||
|
|
@ -313,13 +320,6 @@ func (cmd *CLICommand) Run(ctx context.Context) error {
|
|||
// block; those are intentional as they demarc records within the csv.
|
||||
line += "\n"
|
||||
|
||||
if !inMidCommand {
|
||||
// Handle the exit command.
|
||||
if line == exitCommand || line == exitCommand+terminationChar {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// Look for a termination character;
|
||||
parts := strings.Split(line, terminationChar)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue