@@ -7,7 +7,8 @@ import Settings._
7
7
import core .Contexts ._
8
8
import Properties ._
9
9
10
- import scala .collection .JavaConverters ._
10
+ import scala .PartialFunction .cond
11
+ import scala .collection .JavaConverters ._
11
12
12
13
trait CliCommand :
13
14
@@ -107,7 +108,7 @@ trait CliCommand:
107
108
// For now, skip the default values that do not make sense for the end user.
108
109
// For example 'false' for the version command.
109
110
" "
110
- s " ${formatName(s.name)} ${formatDescription(s.description )}${formatSetting(" Default" , defaultValue)}${formatSetting(" Choices" , s.legalChoices)}"
111
+ s " ${formatName(s.name)} ${formatDescription(shortHelp(s) )}${formatSetting(" Default" , defaultValue)}${formatSetting(" Choices" , s.legalChoices)}"
111
112
ss.map(helpStr).mkString(" " , " \n " , s " \n ${formatName(" @<file>" )} ${formatDescription(" A text file containing compiler arguments (options and source files)." )}\n " )
112
113
end availableOptionsMsg
113
114
@@ -123,15 +124,30 @@ trait CliCommand:
123
124
prefix + " \n " + availableOptionsMsg(cond)
124
125
125
126
protected def isStandard (s : Setting [? ])(using settings : ConcreteSettings )(using SettingsState ): Boolean =
126
- ! isAdvanced(s) && ! isPrivate(s)
127
+ ! isVerbose(s) && ! isWarning(s) && ! isAdvanced(s) && ! isPrivate(s) || s.name == " -Werror" || s.name == " -Wconf"
128
+ protected def isVerbose (s : Setting [? ])(using settings : ConcreteSettings )(using SettingsState ): Boolean =
129
+ s.name.startsWith(" -V" ) && s.name != " -V"
130
+ protected def isWarning (s : Setting [? ])(using settings : ConcreteSettings )(using SettingsState ): Boolean =
131
+ s.name.startsWith(" -W" ) && s.name != " -W" || s.name == " -Xlint"
127
132
protected def isAdvanced (s : Setting [? ])(using settings : ConcreteSettings )(using SettingsState ): Boolean =
128
133
s.name.startsWith(" -X" ) && s.name != " -X"
129
134
protected def isPrivate (s : Setting [? ])(using settings : ConcreteSettings )(using SettingsState ): Boolean =
130
135
s.name.startsWith(" -Y" ) && s.name != " -Y"
136
+ protected def shortHelp (s : Setting [? ])(using settings : ConcreteSettings )(using SettingsState ): String =
137
+ s.description.linesIterator.next()
138
+ protected def isHelping (s : Setting [? ])(using settings : ConcreteSettings )(using SettingsState ): Boolean =
139
+ cond(s.value) {
140
+ case ss : List [? ] if s.isMultivalue => ss.contains(" help" )
141
+ case s : String => " help" == s
142
+ }
131
143
132
144
/** Messages explaining usage and options */
133
145
protected def usageMessage (using settings : ConcreteSettings )(using SettingsState ) =
134
146
createUsageMsg(" where possible standard" , shouldExplain = false , isStandard)
147
+ protected def vusageMessage (using settings : ConcreteSettings )(using SettingsState ) =
148
+ createUsageMsg(" Possible verbose" , shouldExplain = true , isVerbose)
149
+ protected def wusageMessage (using settings : ConcreteSettings )(using SettingsState ) =
150
+ createUsageMsg(" Possible warning" , shouldExplain = true , isWarning)
135
151
protected def xusageMessage (using settings : ConcreteSettings )(using SettingsState ) =
136
152
createUsageMsg(" Possible advanced" , shouldExplain = true , isAdvanced)
137
153
protected def yusageMessage (using settings : ConcreteSettings )(using SettingsState ) =
0 commit comments