Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c85178d

Browse files
committed
Add underscore variant
1 parent 2a2df24 commit c85178d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cmd/github-mcp-server/main.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ var (
4949
Token: token,
5050
EnabledToolsets: enabledToolsets,
5151
DynamicToolsets: viper.GetBool("dynamic_toolsets"),
52-
ReadOnly: viper.GetBool("read-only"),
52+
ReadOnly: viper.GetBool("read-only") || viper.GetBool("read_only"),
5353
ExportTranslations: viper.GetBool("export-translations"),
5454
EnableCommandLogging: viper.GetBool("enable-command-logging"),
5555
LogFilePath: viper.GetString("log-file"),
@@ -65,10 +65,13 @@ func init() {
6565

6666
rootCmd.SetVersionTemplate("{{.Short}}\n{{.Version}}\n")
6767

68+
readOnlyFlag := false
69+
6870
// Add global flags that will be shared by all commands
6971
rootCmd.PersistentFlags().StringSlice("toolsets", github.DefaultTools, "An optional comma separated list of groups of tools to allow, defaults to enabling all")
7072
rootCmd.PersistentFlags().Bool("dynamic-toolsets", false, "Enable dynamic toolsets")
71-
rootCmd.PersistentFlags().Bool("read-only", false, "Restrict the server to read-only operations")
73+
rootCmd.PersistentFlags().BoolVar(&readOnlyFlag, "read-only", false, "Restrict the server to read-only operations")
74+
rootCmd.PersistentFlags().BoolVar(&readOnlyFlag, "read_only", false, "Restrict the server to read-only operations")
7275
rootCmd.PersistentFlags().String("log-file", "", "Path to log file")
7376
rootCmd.PersistentFlags().Bool("enable-command-logging", false, "When enabled, the server will log all command requests and responses to the log file")
7477
rootCmd.PersistentFlags().Bool("export-translations", false, "Save translations to a JSON file")

0 commit comments

Comments
 (0)