parseRepoArg splits "owner/repo" or "owner/repo@branch" into components.
(arg string)
| 2059 | |
| 2060 | // parseRepoArg splits "owner/repo" or "owner/repo@branch" into components. |
| 2061 | func parseRepoArg(arg string) (owner, repo, branch string) { |
| 2062 | branch = "main" |
| 2063 | // Handle @branch suffix. |
| 2064 | if idx := strings.LastIndex(arg, "@"); idx > 0 { |
| 2065 | branch = arg[idx+1:] |
| 2066 | arg = arg[:idx] |
| 2067 | } |
| 2068 | parts := strings.SplitN(arg, "/", 2) |
| 2069 | if len(parts) != 2 { |
| 2070 | return "", "", "" |
| 2071 | } |
| 2072 | return parts[0], parts[1], branch |
| 2073 | } |
| 2074 | |
| 2075 | // isAlreadyInstalled checks whether the named entity is already installed for the given app. |
| 2076 | func isAlreadyInstalled(name string, kind entities.Kind, app string) bool { |