mirror of https://github.com/sbt/sbt.git
Add lastGrep command
This commit is contained in:
parent
218621b745
commit
3e201cee4d
|
|
@ -40,7 +40,6 @@ import sbt.internal.util.{
|
|||
Types
|
||||
}
|
||||
import sbt.util.{ Level, Logger, Show }
|
||||
|
||||
import sbt.internal.util.complete.{ DefaultParsers, Parser }
|
||||
import sbt.internal.inc.ScalaInstance
|
||||
import sbt.compiler.EvalImports
|
||||
|
|
@ -52,7 +51,6 @@ import xsbti.compile.CompilerCache
|
|||
import scala.annotation.tailrec
|
||||
import sbt.io.IO
|
||||
import sbt.io.syntax._
|
||||
|
||||
import java.io.{ File, IOException }
|
||||
import java.net.URI
|
||||
import java.util.{ Locale, Properties }
|
||||
|
|
@ -198,6 +196,7 @@ object BuiltinCommands {
|
|||
startServer,
|
||||
eval,
|
||||
last,
|
||||
oldLastGrep,
|
||||
lastGrep,
|
||||
export,
|
||||
boot,
|
||||
|
|
@ -452,8 +451,15 @@ object BuiltinCommands {
|
|||
s
|
||||
}
|
||||
|
||||
@deprecated("Use `lastGrep` instead.", "1.2.0")
|
||||
def oldLastGrep: Command =
|
||||
lastGrepCommand(OldLastGrepCommand, oldLastGrepBrief, oldLastGrepDetailed)
|
||||
|
||||
def lastGrep: Command =
|
||||
Command(LastGrepCommand, lastGrepBrief, lastGrepDetailed)(lastGrepParser) {
|
||||
lastGrepCommand(LastGrepCommand, lastGrepBrief, lastGrepDetailed)
|
||||
|
||||
private def lastGrepCommand(name: String, briefHelp: (String, String), detail: String): Command =
|
||||
Command(name, briefHelp, detail)(lastGrepParser) {
|
||||
case (s, (pattern, Some(sks))) =>
|
||||
val (str, _, display) = extractLast(s)
|
||||
Output.lastGrep(sks, str.streams(s), pattern, printLast)(display)
|
||||
|
|
|
|||
|
|
@ -57,10 +57,23 @@ $ShowCommand <task>
|
|||
def pluginsDetailed = pluginsBrief // TODO: expand
|
||||
|
||||
val LastCommand = "last"
|
||||
val LastGrepCommand = "last-grep"
|
||||
val OldLastGrepCommand = "last-grep"
|
||||
val LastGrepCommand = "lastGrep"
|
||||
val ExportCommand = "export"
|
||||
val ExportStream = "export"
|
||||
|
||||
val oldLastGrepBrief =
|
||||
(OldLastGrepCommand, "Shows lines from the last output for 'key' that match 'pattern'.")
|
||||
val oldLastGrepDetailed =
|
||||
s"""$OldLastGrepCommand <pattern>
|
||||
Displays lines from the logging of previous commands that match `pattern`.
|
||||
|
||||
$OldLastGrepCommand <pattern> [key]
|
||||
Displays lines from logging associated with `key` that match `pattern`. The key typically refers to a task (for example, test:compile). The logging that is displayed is restricted to the logging for that particular task.
|
||||
|
||||
<pattern> is a regular expression interpreted by java.util.Pattern. Matching text is highlighted (when highlighting is supported and enabled).
|
||||
See also '$LastCommand'."""
|
||||
|
||||
val lastGrepBrief =
|
||||
(LastGrepCommand, "Shows lines from the last output for 'key' that match 'pattern'.")
|
||||
val lastGrepDetailed =
|
||||
|
|
|
|||
Loading…
Reference in New Issue