Merge pull request #4159 from Asamsig/1.x

Migrated last command strings to camelCase
This commit is contained in:
Dale Wijnand 2018-05-15 14:04:48 +02:00 committed by GitHub
commit aabb6a1e36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 11 deletions

View File

@ -187,6 +187,7 @@ object BuiltinCommands {
inspect,
loadProjectImpl,
loadFailed,
oldLoadFailed,
Cross.crossBuild,
Cross.switchVersion,
PluginCross.pluginCross,
@ -468,13 +469,21 @@ object BuiltinCommands {
@deprecated("Use `lastGrep` instead.", "1.2.0")
def oldLastGrep: Command =
lastGrepCommand(OldLastGrepCommand, oldLastGrepBrief, oldLastGrepDetailed)
lastGrepCommand(OldLastGrepCommand, oldLastGrepBrief, oldLastGrepDetailed, { s =>
s.log.warn(deprecationWarningText(OldLastGrepCommand, LastGrepCommand))
lastGrepParser(s)
})
def lastGrep: Command =
lastGrepCommand(LastGrepCommand, lastGrepBrief, lastGrepDetailed)
lastGrepCommand(LastGrepCommand, lastGrepBrief, lastGrepDetailed, lastGrepParser)
private def lastGrepCommand(name: String, briefHelp: (String, String), detail: String): Command =
Command(name, briefHelp, detail)(lastGrepParser) {
private def lastGrepCommand(
name: String,
briefHelp: (String, String),
detail: String,
parser: State => Parser[(String, Option[AnyKeys])]
): Command =
Command(name, briefHelp, detail)(parser) {
case (s, (pattern, Some(sks))) =>
val (str, _, display) = extractLast(s)
Output.lastGrep(sks, str.streams(s), pattern, printLast)(display)
@ -670,6 +679,18 @@ object BuiltinCommands {
Command.make(ProjectCommand, projectBrief, projectDetailed)(ProjectNavigation.command)
def loadFailed: Command = Command(LoadFailed)(loadProjectParser)(doLoadFailed)
@deprecated("Use `loadFailed` instead.", "1.2.0")
def oldLoadFailed: Command =
Command(OldLoadFailed) { s =>
s.log.warn(
deprecationWarningText(OldLoadFailed, LoadFailed)
)
loadProjectParser(s)
}(doLoadFailed)
private[this] def deprecationWarningText(oldCommand: String, newCommand: String) = {
s"The `$oldCommand` command is deprecated in favor of `$newCommand` and will be removed in a later version"
}
@tailrec
private[this] def doLoadFailed(s: State, loadArg: String): State = {

View File

@ -280,16 +280,12 @@ $ProjectsCommand remove <URI>+
def sbtrc = ".sbtrc"
def DefaultsCommand = "add-default-commands"
def DefaultsCommand = "addDefaultCommands"
def DefaultsBrief = (DefaultsCommand, DefaultsDetailed)
def DefaultsDetailed = "Registers default built-in commands"
def Load = "load"
def LoadLabel = "a project"
def LoadCommand = "load-commands"
def LoadCommandLabel = "commands"
def LoadFailed = "load-failed"
def LoadFailed = "loadFailed"
def OldLoadFailed = "load-failed"
def LoadProjectImpl = "loadp"
def LoadProject = "reload"