Skip to content

Commit

Permalink
UI fixes and newlines (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeCooper authored Oct 20, 2020
1 parent fc44c01 commit d2fe941
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
11 changes: 10 additions & 1 deletion cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,25 @@ import (
"fmt"

"github.com/railwayapp/cli/entity"
"github.com/railwayapp/cli/ui"
)

func (h *Handler) List(ctx context.Context, req *entity.CommandRequest) error {
projectId, err := h.cfg.GetProject()
if err != nil {
return err
}
projects, err := h.ctrl.GetProjects(ctx)
if err != nil {
return err
}

for _, v := range projects {
fmt.Println(v.Name)
if projectId == v.Id {
fmt.Println(ui.MagentaText(v.Name))
continue
}
fmt.Println(ui.GrayText(v.Name))
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion cmd/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func (h *Handler) Login(ctx context.Context, req *entity.CommandRequest) error {
return err
}

fmt.Printf(fmt.Sprintf("🎉 Logged in as %s (%s)", ui.Bold(user.Name), user.Email))
fmt.Printf(fmt.Sprintf("🎉 Logged in as %s (%s)\n", ui.Bold(user.Name), user.Email))

return nil
}
6 changes: 3 additions & 3 deletions cmd/whoami.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ func (h *Handler) Whoami(ctx context.Context, req *entity.CommandRequest) error
return err
}

userText := fmt.Sprintf("%s", user.Email)
userText := fmt.Sprintf("%s", ui.MagentaText(user.Email))
if user.Name != "" {
userText = fmt.Sprintf("%s (%s)", user.Name, user.Email)
userText = fmt.Sprintf("%s (%s)", user.Name, ui.MagentaText(user.Email))
}
fmt.Println(fmt.Sprintf("👋 Hey, %s", ui.MagentaText(userText)))
fmt.Println(fmt.Sprintf("👋 Hey %s", userText))

// Todo, more info, also more fun
return nil
Expand Down
2 changes: 1 addition & 1 deletion controller/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (c *Controller) browserBasedLogin(ctx context.Context) (*entity.User, error
}()

url := getBrowserBasedLoginURL(port, code)
err = confirmBrowserOpen("Logging in...", url)
err = confirmBrowserOpen("Logging in...\n", url)

if err != nil {
// Opening the browser failed. Try browserless login
Expand Down

0 comments on commit d2fe941

Please sign in to comment.