on main help sign in
feat: show a different message if crush is built from source
commit12f093d83e7dbd75df725d661959a3887868627f authorAndrey Nering <andreynering@users.noreply.github.com> dateTue 18 Nov 2025, 14:52 (1 year ago) parentfb7d5b6
5 files changed+9−11
internal/app/app.go+1 internal/pubsub/events.go+1 internal/tui/tui.go+3 internal/update/update.go+4−4 internal/update/update_test.go−7
internal/app/app.go+1
@@ -408,5 +408,6 @@ func (app *App) checkForUpdates(ctx context.Context) {
408408 app.events <- pubsub.UpdateAvailableMsg{
409409 CurrentVersion: info.Current,
410410 LatestVersion: info.Latest,
411+ IsDevelopment: info.IsDevelopment(),
411412 }
412413}
internal/pubsub/events.go+1
@@ -31,4 +31,5 @@ type (
3131type UpdateAvailableMsg struct {
3232 CurrentVersion string
3333 LatestVersion string
34+ IsDevelopment bool
3435}
internal/tui/tui.go+3
@@ -376,6 +376,9 @@ func (a *appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
376376 case pubsub.UpdateAvailableMsg:
377377 // Show update notification in status bar
378378 statusMsg := fmt.Sprintf("Crush update available: v%s → v%s.", msg.CurrentVersion, msg.LatestVersion)
379+ if msg.IsDevelopment {
380+ statusMsg = fmt.Sprintf("This is a development version of Crush. The latest version is v%s.", msg.LatestVersion)
381+ }
379382 s, statusCmd := a.status.Update(util.InfoMsg{
380383 Type: util.InfoTypeInfo,
381384 Msg: statusMsg,
internal/update/update.go+4−4
@@ -25,6 +25,10 @@ type Info struct {
2525 URL string
2626}
2727
28+func (i Info) IsDevelopment() bool {
29+ return i.Current == "devel" || i.Current == "unknown" || strings.Contains(i.Current, "dirty")
30+}
31+
2832// Available returns true if there's an update available.
2933//
3034// If both current and latest are stable versions, returns true if versions are
@@ -52,10 +56,6 @@ func Check(ctx context.Context, current string, client Client) (Info, error) {
5256 Latest: current,
5357 }
5458
55− if info.Current == "devel" || info.Current == "unknown" || strings.Contains(info.Current, "dirty") {
56− return info, nil
57− }
58−
5959 release, err := client.Latest(ctx)
6060 if err != nil {
6161 return info, fmt.Errorf("failed to fetch latest release: %w", err)
internal/update/update_test.go−7
@@ -7,13 +7,6 @@ import (
77 "github.com/stretchr/testify/require"
88)
99
10−func TestCheckForUpdate_DevelopmentVersion(t *testing.T) {
11− info, err := Check(t.Context(), "unknown", testClient{"v0.11.0"})
12− require.NoError(t, err)
13− require.NotNil(t, info)
14− require.False(t, info.Available())
15−}
16−
1710func TestCheckForUpdate_Old(t *testing.T) {
1811 info, err := Check(t.Context(), "v0.10.0", testClient{"v0.11.0"})
1912 require.NoError(t, err)