@@ -36,6 +36,9 @@ type CLI struct {
36
36
37
37
// Run invokes the CLI with the given arguments
38
38
func (c * CLI ) Run (args []string ) int {
39
+ fmt .Fprintf (c .OutStream , "btcli Version: %s(%s)\n " , c .Version , c .Revision )
40
+ fmt .Fprintf (c .OutStream , "Please use `exit` or `Ctrl-D` to exit this program.\n " )
41
+
39
42
conf , err := c .loadConfig (args )
40
43
if err != nil {
41
44
fmt .Fprintf (c .ErrStream , "args parse error: %v\n " , err )
@@ -45,10 +48,9 @@ func (c *CLI) Run(args []string) int {
45
48
histories := []string {}
46
49
f , err := loadHistoryFile (conf )
47
50
if err != nil {
48
- // NOTE: Continue processing even if an error occurred at open a file
51
+ // Continue processing even if an error occurred at open a file
49
52
fmt .Fprintf (c .ErrStream , "failed to a history file open: %v\n " , err )
50
53
} else {
51
- // TODO: Read lines and set to histories
52
54
s := bufio .NewScanner (f )
53
55
for s .Scan () {
54
56
histories = append (histories , s .Text ())
@@ -61,9 +63,6 @@ func (c *CLI) Run(args []string) int {
61
63
fmt .Fprintf (c .ErrStream , "failed to initialized prompt: %v\n " , err )
62
64
return ExitCodeError
63
65
}
64
-
65
- fmt .Fprintf (c .OutStream , "btcli Version: %s(%s)\n " , c .Version , c .Revision )
66
- fmt .Fprintf (c .OutStream , "Please use `exit` or `Ctrl-D` to exit this program.\n " )
67
66
p .Run ()
68
67
69
68
// TODO: This is dead code. Invoke os.Exit by the prompt.Run
0 commit comments