Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.9.1
v0.9.2
18 changes: 16 additions & 2 deletions cmd/book/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,28 @@ import (
)

var (
version = "internal"
version = "internal"
buildTime string
)

// SetVersion sets the application version string used by the CLI.
func SetVersion(v string) {
version = v
}

// SetBuildTime sets the build timestamp for version display.
func SetBuildTime(bt string) {
buildTime = bt
}

func buildVersion() string {
v := version
if buildTime != "" {
v += " (" + buildTime + ")"
}
return v
}

// Main builds and runs the book CLI application.
func Main() {
var confirm bool
Expand All @@ -55,7 +69,7 @@ func Main() {
Name: "book",
Usage: "mark ur life!",
Description: "all your marks are belong to us ...",
Version: version,
Version: buildVersion(),
EnableShellCompletion: true,
HideVersion: false,
Flags: []cli.Flag{
Expand Down
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import (
var versionFile string

// version and buildTime are set by GoReleaser via ldflags at build time.
var version string
var (
version string
buildTime string
)

// use embedded VERSION file for local `go install`d version
func init() {
Expand All @@ -23,5 +26,6 @@ func init() {

func main() {
cmd.SetVersion(version)
cmd.SetBuildTime(buildTime)
cmd.Main()
}
Loading