Skip to content

Commit

Permalink
Merge pull request #31 from takashabe/fix-welcome-message
Browse files Browse the repository at this point in the history
Fix init message
  • Loading branch information
takashabe authored Sep 21, 2018
2 parents afe5d6d + 360a67d commit c8a51d9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion api/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func (c *Config) setFromGcloud() error {
}

if c.Project == "" && gcloudConfig.Configuration.Properties.Core.Project != "" {
fmt.Fprintf(c.ErrStream, "gcloud active project is \"%s\"", gcloudConfig.Configuration.Properties.Core.Project)
fmt.Fprintf(c.ErrStream, "gcloud active project is \"%s\"\n", gcloudConfig.Configuration.Properties.Core.Project)
c.Project = gcloudConfig.Configuration.Properties.Core.Project
}

Expand Down
9 changes: 4 additions & 5 deletions api/interfaces/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ type CLI struct {

// Run invokes the CLI with the given arguments
func (c *CLI) Run(args []string) int {
fmt.Fprintf(c.OutStream, "btcli Version: %s(%s)\n", c.Version, c.Revision)
fmt.Fprintf(c.OutStream, "Please use `exit` or `Ctrl-D` to exit this program.\n")

conf, err := c.loadConfig(args)
if err != nil {
fmt.Fprintf(c.ErrStream, "args parse error: %v\n", err)
Expand All @@ -45,10 +48,9 @@ func (c *CLI) Run(args []string) int {
histories := []string{}
f, err := loadHistoryFile(conf)
if err != nil {
// NOTE: Continue processing even if an error occurred at open a file
// Continue processing even if an error occurred at open a file
fmt.Fprintf(c.ErrStream, "failed to a history file open: %v\n", err)
} else {
// TODO: Read lines and set to histories
s := bufio.NewScanner(f)
for s.Scan() {
histories = append(histories, s.Text())
Expand All @@ -61,9 +63,6 @@ func (c *CLI) Run(args []string) int {
fmt.Fprintf(c.ErrStream, "failed to initialized prompt: %v\n", err)
return ExitCodeError
}

fmt.Fprintf(c.OutStream, "btcli Version: %s(%s)\n", c.Version, c.Revision)
fmt.Fprintf(c.OutStream, "Please use `exit` or `Ctrl-D` to exit this program.\n")
p.Run()

// TODO: This is dead code. Invoke os.Exit by the prompt.Run
Expand Down

0 comments on commit c8a51d9

Please sign in to comment.