Skip to content

Commit 66c25e4

Browse files
author
Dmytro Lukianenko
committed
[ADD] Display current branch in UI and propagate branch metadata through meta structures.
1 parent 1c4ae74 commit 66c25e4

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

cmd/evo/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ func runInstaller(ctx context.Context, mode ui.Mode, installOpt *installengine.O
370370
res, err := ui.RunWithCancel(ctx, mode, events, actions, ui.Meta{
371371
Version: Version,
372372
Tagline: "The world’s fastest CMS!",
373+
Branch: strings.TrimSpace(opt.Branch),
373374
}, cancel, logger)
374375
runErr = err
375376
postExec = res.PostExecCommand

internal/ui/meta.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ package ui
33
type Meta struct {
44
Version string
55
Tagline string
6+
Branch string
67
}
7-

internal/ui/view.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,12 +320,23 @@ func (m *Model) releaseVersionLine() (string, lipgloss.Style) {
320320
return "Fetching version…", mutedStyle
321321
}
322322
if m.state.Release.Error != "" {
323-
return "v—", mutedStyle
323+
return m.appendBranch("v—"), mutedStyle
324324
}
325325
if m.state.Release.Highest.HighestVersion != "" {
326-
return "v" + m.state.Release.Highest.HighestVersion, versionStyle
326+
return m.appendBranch("v" + m.state.Release.Highest.HighestVersion), versionStyle
327327
}
328-
return "v—", mutedStyle
328+
return m.appendBranch("v—"), mutedStyle
329+
}
330+
331+
func (m *Model) appendBranch(versionLine string) string {
332+
branch := strings.TrimSpace(m.meta.Branch)
333+
if branch == "" {
334+
return versionLine
335+
}
336+
if !strings.HasPrefix(versionLine, "v") {
337+
return versionLine
338+
}
339+
return versionLine + " (branch " + branch + ")"
329340
}
330341

331342
func formatVersion(v string) string {

0 commit comments

Comments
 (0)