@@ -115,11 +115,17 @@ var RawDefault = struct {
115
115
// IMAPPort: 10143,
116
116
}
117
117
118
+ var flagFlatKeys map [string ]string = map [string ]string {
119
+ "time-format" : "time_format" ,
120
+ "data-directory" : "data_directory" ,
121
+ "python-executable" : "python_executable" ,
122
+ }
123
+
118
124
func WithFlagSet (flags * flag.FlagSet ) * flag.FlagSet {
119
125
flags .String ("config" , "" , flagUsageString ("" , "Path to config file." ))
120
- flags .String ("time_format " , "" , flagUsageString (TimeFormat12H , fmt .Sprintf ("Format for time display (%s/%s)." , TimeFormat12H , TimeFormat24H )))
121
- flags .String ("data_directory " , "" , flagUsageString (RawDefault .DataDirectory , "Path to data directory." ))
122
- flags .String ("python_executable " , "" , flagUsageString (RawDefault .PythonExecutable , "Python executable." ))
126
+ flags .String ("time-format " , "" , flagUsageString (TimeFormat12H , fmt .Sprintf ("Format for time display (%s/%s)." , TimeFormat12H , TimeFormat24H )))
127
+ flags .String ("data-directory " , "" , flagUsageString (RawDefault .DataDirectory , "Path to data directory." ))
128
+ flags .String ("python-executable " , "" , flagUsageString (RawDefault .PythonExecutable , "Python executable." ))
123
129
flags .Bool ("debug" , false , flagUsageBool (false , "Run in debug mode." ))
124
130
125
131
flags .Bool ("smtp-disable" , false , flagUsageBool (false , "Disable SMTP server." ))
@@ -359,6 +365,9 @@ func NewParser(flags *flag.FlagSet) (Parser, error) {
359
365
if value == "" || value == "0" || value == "false" {
360
366
return "" , nil
361
367
}
368
+ if remap , ok := flagFlatKeys [key ]; ok {
369
+ return remap , ok
370
+ }
362
371
return key , value
363
372
}), nil )
364
373
0 commit comments