Skip to content

Commit

Permalink
feat: add version command and initial version.
Browse files Browse the repository at this point in the history
- Add a `version` command to print the current version of the application.
- Set the initial version to `v0.1.0`.

Signed-off-by: abdullahnettoor <[email protected]>
  • Loading branch information
abdullahnettoor committed Oct 29, 2024
1 parent f4f48af commit ee79793
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions cmd/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
Copyright © 2024 Abdullah Nettoor [email protected]
*/
package cmd

import (
"fmt"

"github.com/spf13/cobra"
)

var (
// Version holds the current version of the application
Version = "v0.1.0"
)

// versionCmd represents the version command
var versionCmd = &cobra.Command{
Use: "version",
Short: "Print the version number of TicTacToe",
Long: `All software has versions. This is TicTacToe's.`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("TicTacToe %s\n", Version)
},
}

func init() {
rootCmd.AddCommand(versionCmd)
}

0 comments on commit ee79793

Please sign in to comment.