@@ -27,12 +27,7 @@ func setupLintersFlagSet(v *viper.Viper, fs *pflag.FlagSet) {
27
27
internal .AddFlagAndBind (v , fs , fs .Bool , "fast" , "linters.fast" , false ,
28
28
color .GreenString ("Enable only fast linters from enabled linters set (first run won't be fast)" ))
29
29
30
- internal .AddHackedStringSliceP (fs , "presets" , "p" ,
31
- color .GreenString (fmt .Sprintf ("Enable presets (%s) of linters.\n " +
32
- "Run 'golangci-lint help linters' to see them.\n " +
33
- "This option implies option --disable-all" ,
34
- strings .Join (lintersdb .AllPresets (), "|" ),
35
- )))
30
+ internal .AddHackedStringSliceP (fs , "presets" , "p" , getPresetsHelp ())
36
31
37
32
fs .StringSlice ("enable-only" , nil ,
38
33
color .GreenString ("Override linters configuration section to only run the specific linter(s)" )) // Flags only.
@@ -68,8 +63,7 @@ func setupRunFlagSet(v *viper.Viper, fs *pflag.FlagSet) {
68
63
}
69
64
70
65
func setupOutputFlagSet (v * viper.Viper , fs * pflag.FlagSet ) {
71
- internal .AddFlagAndBind (v , fs , fs .String , "out-format" , "output.formats" , config .OutFormatColoredLineNumber ,
72
- color .GreenString (fmt .Sprintf ("Formats of output: %s" , strings .Join (config .AllOutputFormats , "|" ))))
66
+ internal .AddFlagAndBind (v , fs , fs .String , "out-format" , "output.formats" , config .OutFormatColoredLineNumber , getOutFormatHelp ())
73
67
internal .AddFlagAndBind (v , fs , fs .Bool , "print-issued-lines" , "output.print-issued-lines" , true ,
74
68
color .GreenString ("Print lines of code with issue" ))
75
69
internal .AddFlagAndBind (v , fs , fs .Bool , "print-linter-name" , "output.print-linter-name" , true ,
@@ -123,6 +117,25 @@ func setupIssuesFlagSet(v *viper.Viper, fs *pflag.FlagSet) {
123
117
color .GreenString ("Fix found issues (if it's supported by the linter)" ))
124
118
}
125
119
120
+ func getPresetsHelp () string {
121
+ parts := []string {color .GreenString ("Enable presets of linters:" )}
122
+ for _ , p := range lintersdb .AllPresets () {
123
+ parts = append (parts , fmt .Sprintf (" - %s" , color .YellowString (p )))
124
+ }
125
+ parts = append (parts , color .GreenString ("Run 'golangci-lint help linters' to see them." ),
126
+ color .GreenString ("This option implies option --disable-all" ))
127
+ return strings .Join (parts , "\n " )
128
+ }
129
+
130
+ func getOutFormatHelp () string {
131
+ parts := []string {color .GreenString ("Formats of output:" )}
132
+ for _ , f := range config .AllOutputFormats {
133
+ parts = append (parts , fmt .Sprintf (" - %s" , color .YellowString (f )))
134
+ }
135
+ parts = append (parts , "" )
136
+ return strings .Join (parts , "\n " )
137
+ }
138
+
126
139
func getDefaultIssueExcludeHelp () string {
127
140
parts := []string {color .GreenString ("Use or not use default excludes:" )}
128
141
0 commit comments