Skip to content

Commit

Permalink
V1.0.0 alpha3 dev (#12)
Browse files Browse the repository at this point in the history
Using version ldflag provided by GoReleaser
  • Loading branch information
gulien authored Jul 7, 2017
1 parent 852d9da commit 00129dd
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
7 changes: 3 additions & 4 deletions commands/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@ package commands
import (
"fmt"

OrbitVersion "github.com/gulien/orbit/version"

"github.com/spf13/cobra"
)

var (
// version is the current version of Orbit.
version = "1.0.0-alpha1"

// versionCmd is the instance of version command.
versionCmd = &cobra.Command{
Use: "version",
Short: "Prints the version number of Orbit",
SilenceUsage: true,
SilenceErrors: true,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("v" + version)
fmt.Println(OrbitVersion.Current)
},
}
)
Expand Down
2 changes: 1 addition & 1 deletion notifier/notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func newOrbitNotifier() *OrbitNotifier {
}
}

// Houston contains the OrbitNotifier instance used by the application.
// Houston is the OrbitNotifier instance used by the application.
var Houston = newOrbitNotifier()

// Mute disables the notifications.
Expand Down
11 changes: 11 additions & 0 deletions orbit.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,21 @@ import (

"github.com/gulien/orbit/commands"
"github.com/gulien/orbit/notifier"
OrbitVersion "github.com/gulien/orbit/version"
)

/*
version will be set by GoReleaser.
It will be the current Git tag (with v prefix stripped) or
the name of the snapshot if you're using the --snapshot flag.
*/
var version = "master"

// main is the root function of the application.
func main() {
OrbitVersion.Current = version

if err := commands.RootCmd.Execute(); err != nil {
notifier.Error(err)
os.Exit(1)
Expand Down
8 changes: 8 additions & 0 deletions version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
Package version is used as a dead simple bridge between main
and command packages.
*/
package version

// Current is the current version of Orbit.
var Current string

0 comments on commit 00129dd

Please sign in to comment.