Skip to content

Commit

Permalink
Fix version command when built from source
Browse files Browse the repository at this point in the history
  • Loading branch information
robinovitch61 committed Jul 22, 2022
1 parent 611e9bd commit 7f7e00f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cmd/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/gliderlabs/ssh"
"github.com/hashicorp/nomad/api"
"github.com/robinovitch61/wander/internal/tui/components/app"
"github.com/robinovitch61/wander/internal/tui/constants"
"github.com/robinovitch61/wander/internal/tui/nomad"
"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand Down Expand Up @@ -289,5 +290,8 @@ func setup(cmd *cobra.Command, overrideToken string) (app.Model, []tea.ProgramOp
}

func getVersion() string {
if Version == "" {
return constants.NoVersionString
}
return Version
}
2 changes: 1 addition & 1 deletion internal/tui/components/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ func (m Model) getFilterPrefix(page nomad.Page) string {

func getVersionString(v, s string) string {
if v == "" {
return "built from source"
return constants.NoVersionString
}
return fmt.Sprintf("%s (%s)", v, s[:7])
}
2 changes: 2 additions & 0 deletions internal/tui/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"time"
)

const NoVersionString = "built from source"

var LogoString = strings.Join([]string{
"█ █ █ █▀█ █▄ █ █▀▄ █▀▀ █▀█",
"▀▄▀▄▀ █▀█ █ ▀█ █▄▀ ██▄ █▀▄",
Expand Down

0 comments on commit 7f7e00f

Please sign in to comment.