@@ -11,7 +11,7 @@ import (
1111)
1212
1313const (
14− githubAPIURL = "https://api.github.com/repos/charmbracelet/crush/releases/latest"
14+ githubApiUrl = "https://api.github.com/repos/charmbracelet/crush/releases/latest"
1515 userAgent = "crush/1.0"
1616)
1717
@@ -34,13 +34,11 @@ type Info struct {
3434func (i Info) Available() bool {
3535 cpr := strings.Contains(i.Current, "-")
3636 lpr := strings.Contains(i.Latest, "-")
37− // current is pre release
38− if cpr {
39− // latest isn't a prerelease
40− if !lpr {
41− return true
42− }
37+ // current is pre release && latest isn't a prerelease
38+ if cpr && !lpr {
39+ return true
4340 }
41+ // latest is pre release && current isn't a prerelease
4442 if lpr && !cpr {
4543 return false
4644 }
@@ -88,7 +86,7 @@ func (c *github) Latest(ctx context.Context) (*Release, error) {
8886 Timeout: 30 * time.Second,
8987 }
9088
91− req, err := http.NewRequestWithContext(ctx, "GET", githubAPIURL, nil)
89+ req, err := http.NewRequestWithContext(ctx, "GET", githubApiUrl, nil)
9290 if err != nil {
9391 return nil, err
9492 }
@@ -103,7 +101,7 @@ func (c *github) Latest(ctx context.Context) (*Release, error) {
103101
104102 if resp.StatusCode != http.StatusOK {
105103 body, _ := io.ReadAll(resp.Body)
106− return nil, fmt.Errorf("GitHub API returned status %d: %s", resp.StatusCode, string(body))
104+ return nil, fmt.Errorf("github api returned status %d: %s", resp.StatusCode, string(body))
107105 }
108106
109107 var release Release