From 9c1cb6a4d0511828bebdc3db701f7f8921b74c78 Mon Sep 17 00:00:00 2001 From: Joe Ton Date: Sat, 5 Apr 2025 15:03:04 -0700 Subject: [PATCH 1/3] refactor: improve version output using SetVersionTemplate --- cmd/github-mcp-server/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/github-mcp-server/main.go b/cmd/github-mcp-server/main.go index f3dff6d31..005cb319e 100644 --- a/cmd/github-mcp-server/main.go +++ b/cmd/github-mcp-server/main.go @@ -30,7 +30,7 @@ var ( Use: "server", Short: "GitHub MCP Server", Long: `A GitHub MCP server that handles various tools and resources.`, - Version: fmt.Sprintf("%s (%s) %s", version, commit, date), + Version: version, } stdioCmd = &cobra.Command{ @@ -64,6 +64,9 @@ var ( func init() { cobra.OnInitialize(initConfig) + rootCmd.SetVersionTemplate(fmt.Sprintf( + "GitHub MCP Server\nVersion: %s\nCommit: %s\nBuild Date: %s\n", version, commit, date)) + // Add global flags that will be shared by all commands rootCmd.PersistentFlags().Bool("read-only", false, "Restrict the server to read-only operations") rootCmd.PersistentFlags().String("log-file", "", "Path to log file") From 7eaf791a0e26a74401e695d2399c2d5486be5baf Mon Sep 17 00:00:00 2001 From: Sam Morrow Date: Tue, 15 Apr 2025 14:25:29 +0200 Subject: [PATCH 2/3] chore: improve --version command --- cmd/github-mcp-server/main.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cmd/github-mcp-server/main.go b/cmd/github-mcp-server/main.go index 005cb319e..837337ac4 100644 --- a/cmd/github-mcp-server/main.go +++ b/cmd/github-mcp-server/main.go @@ -30,7 +30,7 @@ var ( Use: "server", Short: "GitHub MCP Server", Long: `A GitHub MCP server that handles various tools and resources.`, - Version: version, + Version: fmt.Sprintf("Version: %s\nCommit: %s\nBuild Date: %s", version, commit, date), } stdioCmd = &cobra.Command{ @@ -64,8 +64,7 @@ var ( func init() { cobra.OnInitialize(initConfig) - rootCmd.SetVersionTemplate(fmt.Sprintf( - "GitHub MCP Server\nVersion: %s\nCommit: %s\nBuild Date: %s\n", version, commit, date)) + rootCmd.SetVersionTemplate("{{.Short}}\n{{.Version}}\n") // Add global flags that will be shared by all commands rootCmd.PersistentFlags().Bool("read-only", false, "Restrict the server to read-only operations") From 106def2a2849b9779713302c8a76397f04082b2a Mon Sep 17 00:00:00 2001 From: Sam Morrow Date: Tue, 15 Apr 2025 14:29:45 +0200 Subject: [PATCH 3/3] chore: use tabs not spaces --- cmd/github-mcp-server/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/github-mcp-server/main.go b/cmd/github-mcp-server/main.go index 837337ac4..f88c71e3b 100644 --- a/cmd/github-mcp-server/main.go +++ b/cmd/github-mcp-server/main.go @@ -64,7 +64,7 @@ var ( func init() { cobra.OnInitialize(initConfig) - rootCmd.SetVersionTemplate("{{.Short}}\n{{.Version}}\n") + rootCmd.SetVersionTemplate("{{.Short}}\n{{.Version}}\n") // Add global flags that will be shared by all commands rootCmd.PersistentFlags().Bool("read-only", false, "Restrict the server to read-only operations")