Skip to content

Commit

Permalink
Merge pull request hashicorp#207 from jrasell/f_0.2.1_dev
Browse files Browse the repository at this point in the history
Update for 0.2.1 development effort.
  • Loading branch information
jrasell authored Jul 5, 2018
2 parents c6e7295 + a642754 commit 749536e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 0.2.1 (Unreleased)

## 0.2.0 (4 July 2018)

IMPROVEMENTS:
Expand Down
14 changes: 4 additions & 10 deletions command/version.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package command

import (
"bytes"
"fmt"

"github.com/jrasell/levant/buildtime"
Expand All @@ -10,7 +9,6 @@ import (

// VersionCommand is a Command implementation that prints the version.
type VersionCommand struct {
Revision string
Version string
VersionPrerelease string
UI cli.Ui
Expand All @@ -28,18 +26,14 @@ func (c *VersionCommand) Synopsis() string {

// Run executes the version command.
func (c *VersionCommand) Run(_ []string) int {
var versionString bytes.Buffer

fmt.Fprintf(&versionString, "Levant v%s", c.Version)
if c.VersionPrerelease != "" {
fmt.Fprintf(&versionString, "-%s", c.VersionPrerelease)
v := fmt.Sprintf("Levant v%s", c.Version)

if c.Revision != "" {
fmt.Fprintf(&versionString, " (%s)", c.Revision)
}
if c.VersionPrerelease != "" {
v = v + fmt.Sprintf("-%s", c.VersionPrerelease)
}

c.UI.Output(versionString.String())
c.UI.Output(v)
c.UI.Output(fmt.Sprintf("Date: %s", buildtime.BuildDate))
c.UI.Output(fmt.Sprintf("Commit: %s", buildtime.GitCommit))
c.UI.Output(fmt.Sprintf("Branch: %s", buildtime.GitBranch))
Expand Down
9 changes: 8 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,14 @@ func RunCustom(args []string, commands map[string]cli.CommandFactory) int {

exitCode, err := cli.Run()
if err != nil {
fmt.Fprintf(os.Stderr, "Error executing CLI: %s\n", err.Error())
_, pErr := fmt.Fprintf(os.Stderr, "Error executing CLI: %s\n", err.Error())

// If we are unable to log to stderr; try just printing the error to
// provide some insight.
if pErr != nil {
fmt.Print(pErr)
}

return 1
}

Expand Down
4 changes: 2 additions & 2 deletions version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package version
import "fmt"

// Version is the main version number that is being run at the moment.
const Version = "0.2.0"
const Version = "0.2.1"

// VersionPrerelease is a pre-release marker for the version. If this is ""
// (empty string) then it means that it is a final release. Otherwise, this is
// a pre-release such as "dev" (in development), "beta", "rc1", etc.
const VersionPrerelease = ""
const VersionPrerelease = "dev"

// Get returns a human readable version of Levant.
func Get() string {
Expand Down

0 comments on commit 749536e

Please sign in to comment.