mirror of
https://github.com/railwayapp/cli
synced 2026-04-21 14:07:23 +00:00
* Add Linting for CLI * Fire CI * Remove checkout oopsie * Newlint * Clean modcache for now * Lint fixes * Fix failed to write error * Fix CI issues * Workflow comments * Fix print lint errs * Fix * Fix lint issues * Update cmd/build.go Co-authored-by: Jake Runzer <jakerunzer@gmail.com> * Update cmd/whoami.go Co-authored-by: Jake Runzer <jakerunzer@gmail.com> Co-authored-by: Jake Runzer <jakerunzer@gmail.com>
25 lines
510 B
Go
25 lines
510 B
Go
package cmd
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/railwayapp/cli/entity"
|
|
"github.com/railwayapp/cli/ui"
|
|
)
|
|
|
|
func (h *Handler) Whoami(ctx context.Context, req *entity.CommandRequest) error {
|
|
user, err := h.ctrl.GetUser(ctx)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
userText := fmt.Sprintf("%s", ui.MagentaText(user.Email))
|
|
if user.Name != "" {
|
|
userText = fmt.Sprintf("%s (%s)", user.Name, ui.MagentaText(user.Email))
|
|
}
|
|
fmt.Printf("👋 Hey %s\n", userText)
|
|
|
|
// Todo, more info, also more fun
|
|
return nil
|
|
}
|