@@ -7,7 +7,8 @@ import Settings._
77import core .Contexts ._
88import Properties ._
99
10- import scala .collection .JavaConverters ._
10+ import scala .PartialFunction .cond
11+ import scala .collection .JavaConverters ._
1112
1213trait CliCommand :
1314
@@ -107,7 +108,7 @@ trait CliCommand:
107108 // For now, skip the default values that do not make sense for the end user.
108109 // For example 'false' for the version command.
109110 " "
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)}"
111112 ss.map(helpStr).mkString(" " , " \n " , s " \n ${formatName(" @<file>" )} ${formatDescription(" A text file containing compiler arguments (options and source files)." )}\n " )
112113 end availableOptionsMsg
113114
@@ -123,15 +124,30 @@ trait CliCommand:
123124 prefix + " \n " + availableOptionsMsg(cond)
124125
125126 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"
127132 protected def isAdvanced (s : Setting [? ])(using settings : ConcreteSettings )(using SettingsState ): Boolean =
128133 s.name.startsWith(" -X" ) && s.name != " -X"
129134 protected def isPrivate (s : Setting [? ])(using settings : ConcreteSettings )(using SettingsState ): Boolean =
130135 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+ }
131143
132144 /** Messages explaining usage and options */
133145 protected def usageMessage (using settings : ConcreteSettings )(using SettingsState ) =
134146 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)
135151 protected def xusageMessage (using settings : ConcreteSettings )(using SettingsState ) =
136152 createUsageMsg(" Possible advanced" , shouldExplain = true , isAdvanced)
137153 protected def yusageMessage (using settings : ConcreteSettings )(using SettingsState ) =
0 commit comments