@@ -11,7 +11,7 @@ import (
14− githubAPIURL = "https://api.github.com/repos/charmbracelet/crush/releases/latest"
14+ githubApiUrl = "https://api.github.com/repos/charmbracelet/crush/releases/latest"
15 userAgent = "crush/1.0"
15 userAgent = "crush/1.0"
@@ -34,13 +34,11 @@ type Info struct {
34func (i Info) Available() bool {
34func (i Info) Available() bool {
35 cpr := strings.Contains(i.Current, "-")
35 cpr := strings.Contains(i.Current, "-")
36 lpr := strings.Contains(i.Latest, "-")
36 lpr := strings.Contains(i.Latest, "-")
37− // current is pre release
39− // latest isn't a prerelease
37+ // current is pre release && latest isn't a prerelease
40− if !lpr {
38+ if cpr && !lpr {
41− return true
39+ return true
41+ // latest is pre release && current isn't a prerelease
44 if lpr && !cpr {
42 if lpr && !cpr {
45 return false
43 return false
@@ -88,7 +86,7 @@ func (c *github) Latest(ctx context.Context) (*Release, error) {
88 Timeout: 30 * time.Second,
86 Timeout: 30 * time.Second,
91− req, err := http.NewRequestWithContext(ctx, "GET", githubAPIURL, nil)
89+ req, err := http.NewRequestWithContext(ctx, "GET", githubApiUrl, nil)
92 if err != nil {
90 if err != nil {
93 return nil, err
91 return nil, err
@@ -103,7 +101,7 @@ func (c *github) Latest(ctx context.Context) (*Release, error) {
104 if resp.StatusCode != http.StatusOK {
102 if resp.StatusCode != http.StatusOK {
105 body, _ := io.ReadAll(resp.Body)
103 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))
109 var release Release
107 var release Release