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 (
4
4
"errors"
5
5
"fmt"
6
6
"os"
7
+ "strings"
7
8
8
9
"github.com/github/github-mcp-server/internal/ghmcp"
9
10
"github.com/github/github-mcp-server/pkg/github"
10
11
"github.com/spf13/cobra"
12
+ "github.com/spf13/pflag"
11
13
"github.com/spf13/viper"
12
14
)
13
15
@@ -54,14 +56,14 @@ var (
54
56
EnableCommandLogging : viper .GetBool ("enable-command-logging" ),
55
57
LogFilePath : viper .GetString ("log-file" ),
56
58
}
57
-
58
59
return ghmcp .RunStdioServer (stdioServerConfig )
59
60
},
60
61
}
61
62
)
62
63
63
64
func init () {
64
65
cobra .OnInitialize (initConfig )
66
+ rootCmd .SetGlobalNormalizationFunc (wordSepNormalizeFunc )
65
67
66
68
rootCmd .SetVersionTemplate ("{{.Short}}\n {{.Version}}\n " )
67
69
@@ -91,6 +93,7 @@ func initConfig() {
91
93
// Initialize Viper configuration
92
94
viper .SetEnvPrefix ("github" )
93
95
viper .AutomaticEnv ()
96
+
94
97
}
95
98
96
99
func main () {
@@ -99,3 +102,12 @@ func main() {
99
102
os .Exit (1 )
100
103
}
101
104
}
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 (
41
41
github.com/sourcegraph/conc v0.3.0 // indirect
42
42
github.com/spf13/afero v1.14.0 // indirect
43
43
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
45
45
github.com/subosito/gotenv v1.6.0 // indirect
46
46
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
47
47
go.uber.org/multierr v1.11.0 // indirect
You can’t perform that action at this time.
0 commit comments