Skip to content

Commit

Permalink
Move version info inside its own package
Browse files Browse the repository at this point in the history
  • Loading branch information
duaraghav8 committed Oct 20, 2019
1 parent 74a1a85 commit ab2c7ed
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"

cmd "github.com/duaraghav8/okta-admin/command"
"github.com/duaraghav8/okta-admin/version"
"github.com/mitchellh/cli"
)

Expand All @@ -17,8 +18,8 @@ func main() {
}

c := cli.CLI{
Name: AppName,
Version: Version,
Name: version.AppName,
Version: version.FormattedVersion(),
Commands: map[string]cli.CommandFactory{
"create-user": func() (command cli.Command, err error) {
return &cmd.CreateUserCommand{
Expand Down
6 changes: 0 additions & 6 deletions version.go

This file was deleted.

23 changes: 23 additions & 0 deletions version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package version

import "fmt"

// The git commit compiled into the final binaries.
// This will be filled by the compiler.
var GitCommit string

const (
// Name of the CLI application
AppName = "okta-admin"

// Application version
Version = "1.0.0"
)

func FormattedVersion() string {
version := fmt.Sprintf("Okta Admin v%s", Version)
if GitCommit != "" {
return fmt.Sprintf("%s (%s)", version, GitCommit)
}
return version
}

0 comments on commit ab2c7ed

Please sign in to comment.