File tree 1 file changed +7
-3
lines changed
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 8
8
"github.com/c-bata/go-prompt"
9
9
"os"
10
10
"path"
11
+ "strings"
11
12
)
12
13
13
14
var CLI struct {
@@ -18,7 +19,6 @@ var CLI struct {
18
19
19
20
func main () {
20
21
kong .Parse (& CLI , kong .UsageOnError (), kong .Name ("buntdb-cli" ))
21
- defer os .Exit (0 )
22
22
23
23
if CLI .Debug {
24
24
cli .Debug = true
@@ -28,7 +28,11 @@ func main() {
28
28
CLI .Path = db .GetTempDbPath ("buntdb-cli" )
29
29
}
30
30
31
- db .InitBuntDB (CLI .Path )
31
+ err := db .InitBuntDB (CLI .Path )
32
+ if err != nil {
33
+ fmt .Printf ("ERR: %v\n " , err )
34
+ os .Exit (1 )
35
+ }
32
36
defer db .Close ()
33
37
34
38
p := prompt .New (
@@ -44,7 +48,7 @@ func main() {
44
48
}
45
49
}),
46
50
prompt .OptionSetExitCheckerOnInput (func (in string , breakline bool ) bool {
47
- return in == "exit" && breakline
51
+ return strings . TrimSpace ( in ) == "exit" && breakline
48
52
}),
49
53
)
50
54
p .Run ()
You can’t perform that action at this time.
0 commit comments