GetUsername gets the username from the CLI connection
()
| 43 | |
| 44 | // GetUsername gets the username from the CLI connection |
| 45 | func (c *CloudFoundryContext) GetUsername() (string, error) { |
| 46 | username, err := c.cliConnection.Username() |
| 47 | if err != nil { |
| 48 | return "", fmt.Errorf("Could not get username: %s", err) |
| 49 | } |
| 50 | if username == "" { |
| 51 | return "", fmt.Errorf("Not logged in. Use %q to log in.", terminal.CommandColor("cf login")) |
| 52 | } |
| 53 | return username, nil |
| 54 | } |
no test coverage detected