Skip to content

Commit

Permalink
feat: add version
Browse files Browse the repository at this point in the history
  • Loading branch information
nedpals committed Feb 9, 2024
1 parent 3ff1ef5 commit 5d69a98
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
3 changes: 2 additions & 1 deletion server/daemon/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/nedpals/bugbuddy/server/daemon/types"
"github.com/nedpals/bugbuddy/server/helpers"
"github.com/nedpals/bugbuddy/server/logger"
"github.com/nedpals/bugbuddy/server/release"
"github.com/nedpals/bugbuddy/server/rpc"
"github.com/nedpals/errgoengine"
"github.com/nedpals/errgoengine/error_templates"
Expand Down Expand Up @@ -129,7 +130,7 @@ func (d *Server) Handle(ctx context.Context, c *jsonrpc2.Conn, r *jsonrpc2.Reque
// introduce the server to the client
c.Reply(ctx, r.ID, &types.ServerInfo{
Success: true,
Version: "0.1.0",
Version: release.Version(),
ProcessID: info.ProcessId,
SupportedFileExtensions: engineSupportedExtensions,
})
Expand Down
1 change: 1 addition & 0 deletions server/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ require (
)

require (
github.com/carlmjohnson/versioninfo v0.22.5
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/lucasepe/codename v0.2.0
github.com/segmentio/asm v1.2.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions server/go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
github.com/carlmjohnson/versioninfo v0.22.5 h1:O00sjOLUAFxYQjlN/bzYTuZiS0y6fWDQjMRvwtKgwwc=
github.com/carlmjohnson/versioninfo v0.22.5/go.mod h1:QT9mph3wcVfISUKd0i9sZfVrPviHuSF+cUtLjm2WSf8=
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down Expand Up @@ -25,8 +27,6 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
github.com/nedpals/errgoengine v0.0.0-20240202043608-58fd022a3bc4 h1:PAlxtCGnxixq6THwDkjlPd2/ExbfgVpL9UnUBh42qKw=
github.com/nedpals/errgoengine v0.0.0-20240202043608-58fd022a3bc4/go.mod h1:uYC7Mfw/No0v7VerEzJMPt6MdqgS6OYlkWdhan7cnz0=
github.com/nedpals/errgoengine v0.0.0-20240204172620-f4253b2cd98c h1:MofuPKky/AzH2n5asPmo+ybZB3izFwo2ZVt467QlCRQ=
github.com/nedpals/errgoengine v0.0.0-20240204172620-f4253b2cd98c/go.mod h1:uYC7Mfw/No0v7VerEzJMPt6MdqgS6OYlkWdhan7cnz0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
6 changes: 4 additions & 2 deletions server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ import (
"github.com/nedpals/bugbuddy/server/executor"
"github.com/nedpals/bugbuddy/server/helpers"
"github.com/nedpals/bugbuddy/server/lsp_server"
"github.com/nedpals/bugbuddy/server/release"
"github.com/nedpals/errgoengine"
"github.com/spf13/cobra"
)

var rootCmd = &cobra.Command{
Use: "bugbuddy",
Short: "BugBuddy is a runtime error analyzer and assistant.",
Use: "bugbuddy",
Version: release.Version(),
Short: "BugBuddy is a runtime error analyzer and assistant.",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
port, err := cmd.Flags().GetInt("port")
if err != nil {
Expand Down
11 changes: 11 additions & 0 deletions server/release/release.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package release

import (
"fmt"

"github.com/carlmjohnson/versioninfo"
)

func Version() string {
return fmt.Sprintf("%s %s", versioninfo.Short(), versioninfo.Version)
}

0 comments on commit 5d69a98

Please sign in to comment.