Validates enterprise, organization and repo arguments. Both are optional, but at least one should be specified
(enterprise, org, repo string)
| 399 | |
| 400 | // Validates enterprise, organization and repo arguments. Both are optional, but at least one should be specified |
| 401 | func getEnterpriseOrganizationAndRepo(enterprise, org, repo string) (string, string, string, error) { |
| 402 | if len(repo) > 0 { |
| 403 | owner, repository, err := splitOwnerAndRepo(repo) |
| 404 | return "", owner, repository, err |
| 405 | } |
| 406 | if len(org) > 0 { |
| 407 | return "", org, "", nil |
| 408 | } |
| 409 | if len(enterprise) > 0 { |
| 410 | return enterprise, "", "", nil |
| 411 | } |
| 412 | return "", "", "", fmt.Errorf("enterprise, organization and repository are all empty") |
| 413 | } |
| 414 | |
| 415 | func getRegistrationKey(org, repo, enterprise string) string { |
| 416 | return fmt.Sprintf("org=%s,repo=%s,enterprise=%s", org, repo, enterprise) |
no test coverage detected