Skip to content

Commit

Permalink
Add parser version command
Browse files Browse the repository at this point in the history
  • Loading branch information
jerkeeler committed Jan 13, 2025
1 parent 917512e commit 38e2d5a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
35 changes: 35 additions & 0 deletions cmd/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
Copyright © 2025 NAME HERE <EMAIL ADDRESS>
*/
package cmd

import (
"fmt"

"github.com/jerkeeler/restoration/parser"
"github.com/spf13/cobra"
)

// versionCmd represents the version command
var versionCmd = &cobra.Command{
Use: "version",
Short: "Prints the version of the parser",
Long: `Prints the version of the parser`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(parser.VERSION)
},
}

func init() {
rootCmd.AddCommand(versionCmd)

// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// versionCmd.PersistentFlags().String("foo", "", "A help for foo")

// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// versionCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}
1 change: 1 addition & 0 deletions parser/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const OUTER_HIERARCHY_START_OFFSET = 257
const MAX_SCAN_OFFSET = 50
const DATA_OFFSET = 6
const ROOT_NODE_TOKEN = "BG"
const VERSION = "v0.1.4"

var FOOTER = []uint8{0, 1, 0, 0, 0, 0, 0, 0}

Expand Down
2 changes: 1 addition & 1 deletion parser/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func formatRawDataToReplay(
BuildNumber: buildNumber,
BuildString: buildString,
ParsedAt: time.Now(),
ParserVersion: "0.1.0",
ParserVersion: VERSION,
GameLengthSecs: (*commandList)[len(*commandList)-1].GameTimeSecs(),
GameSeed: int((*profileKeys)["gamerandomseed"].Int32Val),
WinningTeam: winningTeam,
Expand Down

0 comments on commit 38e2d5a

Please sign in to comment.