Skip to content

Commit fbadbdd

Browse files
committed
version with tag
1 parent c6aee67 commit fbadbdd

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ script:
2626
# - go get -v ./...
2727
# - diff -u <(echo -n) <(gofmt -d .) # can't make gofmt ignore vendor directory
2828
# - go vet $(go list ./... | grep -v /vendor/)
29-
- if [ "${LATEST}" = "true" ]; then gox -os="linux darwin windows" -arch="amd64" -ldflags "-X main.Rev=`git rev-parse --short HEAD` -X main.builddate=`date -u +%Y%m%d.%H%M%S`" -verbose ./...; fi
29+
- if [ "${LATEST}" = "true" ]; then gox -os="linux darwin windows" -arch="amd64" -ldflags "-X main.Rev=`git rev-parse --short HEAD` -X main.builddate=`date -u +%Y%m%d.%H%M%S` -X main.Version=${TRAVIS_TAG}" -verbose ./...; fi
3030
- mv lazygit_windows_amd64.exe lazygit_windows_amd64_${TRAVIS_TAG}.exe
3131
- mv lazygit_darwin_amd64 lazygit_darwin_amd64_${TRAVIS_TAG}
3232
- mv lazygit_linux_amd64 lazygit_linux_amd64_${TRAVIS_TAG}

gui.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,7 @@ func layout(g *gocui.Gui) error {
225225
v.FgColor = gocui.ColorWhite
226226
}
227227

228-
version := Rev
229-
if version == "" {
230-
version = "unversioned"
231-
}
232-
233-
if v, err := g.SetView("options", -1, optionsTop, width-len(version)-2, optionsTop+2, 0); err != nil {
228+
if v, err := g.SetView("options", -1, optionsTop, width-len(Version)-2, optionsTop+2, 0); err != nil {
234229
if err != gocui.ErrUnknownView {
235230
return err
236231
}
@@ -239,14 +234,14 @@ func layout(g *gocui.Gui) error {
239234
v.Frame = false
240235
}
241236

242-
if v, err := g.SetView("version", width-len(version)-1, optionsTop, width, optionsTop+2, 0); err != nil {
237+
if v, err := g.SetView("version", width-len(Version)-1, optionsTop, width, optionsTop+2, 0); err != nil {
243238
if err != gocui.ErrUnknownView {
244239
return err
245240
}
246241
v.BgColor = gocui.ColorDefault
247242
v.FgColor = gocui.ColorGreen
248243
v.Frame = false
249-
renderString(g, "version", version)
244+
renderString(g, "version", Version)
250245

251246
// these are only called once
252247
handleFileSelect(g, filesView)

main.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,15 @@ import (
1212
)
1313

1414
var (
15-
startTime time.Time
16-
debugging bool
17-
Rev string
15+
startTime time.Time
16+
debugging bool
17+
18+
// Rev - Git Revision
19+
Rev string
20+
21+
// Version - Version number
22+
Version = "unversioned"
23+
1824
builddate string
1925
debuggingPointer = flag.Bool("debug", false, "a boolean")
2026
versionFlag = flag.Bool("v", false, "Print the current version")
@@ -67,7 +73,7 @@ func main() {
6773
devLog("\n\n\n\n\n\n\n\n\n\n")
6874
flag.Parse()
6975
if *versionFlag {
70-
fmt.Printf("rev=%s, build date=%s", Rev, builddate)
76+
fmt.Printf("rev=%s, build date=%s, version=%s", Rev, builddate, Version)
7177
os.Exit(0)
7278
}
7379
verifyInGitRepo()

0 commit comments

Comments
 (0)