⛩️ Powerful yet Minimal Nix Dependency Manager
flake flakes home-manager nixos go nix dependency dependencies

fix(source): dynamically identify host

fuwn.net 9f6bf390 2036ad87

verified
+10 -1
+10 -1
internal/yae/source.go
··· 2 2 3 3 import ( 4 4 "fmt" 5 + "net/url" 5 6 "strings" 6 7 7 8 "github.com/charmbracelet/log" ··· 91 92 92 93 func (source *Source) fetchLatestGitTag() (string, error) { 93 94 if source.Type == "git" { 94 - repository := "https://github.com/" + strings.Split(source.URL, "/")[3] + "/" + strings.Split(source.URL, "/")[4] 95 + url, err := url.Parse(source.URL) 96 + 97 + if err != nil { 98 + return "", err 99 + } 100 + 101 + domain := url.Host 102 + pathSegments := strings.Split(url.Path, "/") 103 + repository := url.Scheme + "://" + domain + "/" + pathSegments[1] + "/" + pathSegments[2] 95 104 remotes, err := command("bash", false, "-c", fmt.Sprintf("git ls-remote %s | awk -F'/' '{print $NF}' | sort -V", repository)) 96 105 97 106 if err != nil {