Skip to content

Commit

Permalink
Added glice version command with version=="3.0.0-alpha"
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Schinkel committed Oct 21, 2022
1 parent ace8078 commit fd9ef10
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
19 changes: 19 additions & 0 deletions cmd/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cmd

import (
glice "github.com/ribice/glice/v3/pkg"

"github.com/spf13/cobra"
)

// versionCmd represents the version command
var versionCmd = &cobra.Command{
Use: "version",
Run: glice.RunVersion,
Short: "Display the current version of Glice",
Long: `Display the current version of Glice in 'v{Major}.{Minor}.{Patch}[-{Prerelease}" format.`,
}

func init() {
rootCmd.AddCommand(versionCmd)
}
3 changes: 3 additions & 0 deletions pkg/const.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
package glice

const AppName = "Glice"
const AppVersion = "3.0.0-alpha"

const LicenseListSourceURL = "https://raw.githubusercontent.com/spdx/license-list-data/master/json/licenses.json"
10 changes: 10 additions & 0 deletions pkg/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package glice

import (
"fmt"
"github.com/spf13/cobra"
)

func RunVersion(cmd *cobra.Command, args []string) {
fmt.Printf("%s v%s\n", AppName, AppVersion)
}

0 comments on commit fd9ef10

Please sign in to comment.