File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -4,10 +4,12 @@ import (
44 "errors"
55 "fmt"
66 "os"
7+ "strings"
78
89 "github.com/github/github-mcp-server/internal/ghmcp"
910 "github.com/github/github-mcp-server/pkg/github"
1011 "github.com/spf13/cobra"
12+ "github.com/spf13/pflag"
1113 "github.com/spf13/viper"
1214)
1315
@@ -54,14 +56,14 @@ var (
5456 EnableCommandLogging : viper .GetBool ("enable-command-logging" ),
5557 LogFilePath : viper .GetString ("log-file" ),
5658 }
57-
5859 return ghmcp .RunStdioServer (stdioServerConfig )
5960 },
6061 }
6162)
6263
6364func init () {
6465 cobra .OnInitialize (initConfig )
66+ rootCmd .SetGlobalNormalizationFunc (wordSepNormalizeFunc )
6567
6668 rootCmd .SetVersionTemplate ("{{.Short}}\n {{.Version}}\n " )
6769
@@ -91,6 +93,7 @@ func initConfig() {
9193 // Initialize Viper configuration
9294 viper .SetEnvPrefix ("github" )
9395 viper .AutomaticEnv ()
96+
9497}
9598
9699func main () {
@@ -99,3 +102,12 @@ func main() {
99102 os .Exit (1 )
100103 }
101104}
105+
106+ func wordSepNormalizeFunc (f * pflag.FlagSet , name string ) pflag.NormalizedName {
107+ from := []string {"_" }
108+ to := "-"
109+ for _ , sep := range from {
110+ name = strings .ReplaceAll (name , sep , to )
111+ }
112+ return pflag .NormalizedName (name )
113+ }
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ require (
4141 github.com/sourcegraph/conc v0.3.0 // indirect
4242 github.com/spf13/afero v1.14.0 // indirect
4343 github.com/spf13/cast v1.7.1 // indirect
44- github.com/spf13/pflag v1.0.6 // indirect
44+ github.com/spf13/pflag v1.0.6
4545 github.com/subosito/gotenv v1.6.0 // indirect
4646 github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
4747 go.uber.org/multierr v1.11.0 // indirect
You can’t perform that action at this time.
0 commit comments