MCPcopy Create free account
hub / github.com/cloudfoundry/multiapps-cli-plugin / GetUsername

Method GetUsername

util/cf_context.go:45–54  ·  view source on GitHub ↗

GetUsername gets the username from the CLI connection

()

Source from the content-addressed store, hash-verified

43
44// GetUsername gets the username from the CLI connection
45func (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}

Callers 2

GetCFTargetMethod · 0.95
cf_context_test.goFile · 0.80

Calls 1

UsernameMethod · 0.80

Tested by

no test coverage detected