-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Align compiler options to VWXY scheme #12751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,8 @@ import Settings._ | |
import core.Contexts._ | ||
import Properties._ | ||
|
||
import scala.collection.JavaConverters._ | ||
import scala.PartialFunction.cond | ||
import scala.collection.JavaConverters._ | ||
|
||
trait CliCommand: | ||
|
||
|
@@ -107,7 +108,7 @@ trait CliCommand: | |
// For now, skip the default values that do not make sense for the end user. | ||
// For example 'false' for the version command. | ||
"" | ||
s"${formatName(s.name)} ${formatDescription(s.description)}${formatSetting("Default", defaultValue)}${formatSetting("Choices", s.legalChoices)}" | ||
s"${formatName(s.name)} ${formatDescription(shortHelp(s))}${formatSetting("Default", defaultValue)}${formatSetting("Choices", s.legalChoices)}" | ||
ss.map(helpStr).mkString("", "\n", s"\n${formatName("@<file>")} ${formatDescription("A text file containing compiler arguments (options and source files).")}\n") | ||
end availableOptionsMsg | ||
|
||
|
@@ -123,15 +124,30 @@ trait CliCommand: | |
prefix + "\n" + availableOptionsMsg(cond) | ||
|
||
protected def isStandard(s: Setting[?])(using settings: ConcreteSettings)(using SettingsState): Boolean = | ||
!isAdvanced(s) && !isPrivate(s) | ||
!isVerbose(s) && !isWarning(s) && !isAdvanced(s) && !isPrivate(s) || s.name == "-Werror" || s.name == "-Wconf" | ||
protected def isVerbose(s: Setting[?])(using settings: ConcreteSettings)(using SettingsState): Boolean = | ||
s.name.startsWith("-V") && s.name != "-V" | ||
protected def isWarning(s: Setting[?])(using settings: ConcreteSettings)(using SettingsState): Boolean = | ||
s.name.startsWith("-W") && s.name != "-W" || s.name == "-Xlint" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is only one option of a kind There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets a thousand flowers bloom and still be manageable. https://github.com/lampepfl/dotty/issues/12785 If I want more output merely (not change in behavior), (But here, I just wanted to say There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another motivation is alignment with Scala 2. |
||
protected def isAdvanced(s: Setting[?])(using settings: ConcreteSettings)(using SettingsState): Boolean = | ||
s.name.startsWith("-X") && s.name != "-X" | ||
protected def isPrivate(s: Setting[?])(using settings: ConcreteSettings)(using SettingsState): Boolean = | ||
s.name.startsWith("-Y") && s.name != "-Y" | ||
protected def shortHelp(s: Setting[?])(using settings: ConcreteSettings)(using SettingsState): String = | ||
s.description.linesIterator.next() | ||
protected def isHelping(s: Setting[?])(using settings: ConcreteSettings)(using SettingsState): Boolean = | ||
cond(s.value) { | ||
case ss: List[?] if s.isMultivalue => ss.contains("help") | ||
case s: String => "help" == s | ||
} | ||
|
||
/** Messages explaining usage and options */ | ||
protected def usageMessage(using settings: ConcreteSettings)(using SettingsState) = | ||
createUsageMsg("where possible standard", shouldExplain = false, isStandard) | ||
protected def vusageMessage(using settings: ConcreteSettings)(using SettingsState) = | ||
createUsageMsg("Possible verbose", shouldExplain = true, isVerbose) | ||
protected def wusageMessage(using settings: ConcreteSettings)(using SettingsState) = | ||
createUsageMsg("Possible warning", shouldExplain = true, isWarning) | ||
protected def xusageMessage(using settings: ConcreteSettings)(using SettingsState) = | ||
createUsageMsg("Possible advanced", shouldExplain = true, isAdvanced) | ||
protected def yusageMessage(using settings: ConcreteSettings)(using SettingsState) = | ||
|
Uh oh!
There was an error while loading. Please reload this page.