mirror of https://github.com/sbt/sbt.git
remove some `format: off` comments
This commit is contained in:
parent
9713b7c112
commit
1a882b0dc3
|
|
@ -63,10 +63,8 @@ private[sbt] final class ArbitraryCommand(
|
|||
new ArbitraryCommand(parser, help, tags.put(key, value))
|
||||
}
|
||||
|
||||
// format: off
|
||||
|
||||
object Command {
|
||||
import DefaultParsers._
|
||||
import DefaultParsers.*
|
||||
|
||||
// Lowest-level command construction
|
||||
|
||||
|
|
@ -152,8 +150,7 @@ object Command {
|
|||
|
||||
def combine(cmds: Seq[Command]): State => Parser[() => State] = {
|
||||
val (simple, arbs) = separateCommands(cmds)
|
||||
state =>
|
||||
arbs.map(_.parser(state)).foldLeft(simpleParser(simple)(state))(_ | _)
|
||||
state => arbs.map(_.parser(state)).foldLeft(simpleParser(simple)(state))(_ | _)
|
||||
}
|
||||
|
||||
private def separateCommands(
|
||||
|
|
@ -168,8 +165,7 @@ object Command {
|
|||
|
||||
private def argParser(sc: SimpleCommand): State => Parser[() => State] = {
|
||||
def usageError = s"${sc.name} usage:" + Help.message(sc.help0, None)
|
||||
s =>
|
||||
(Parser.softFailure(usageError, definitive = true): Parser[() => State]) | sc.parser(s)
|
||||
s => (Parser.softFailure(usageError, definitive = true): Parser[() => State]) | sc.parser(s)
|
||||
}
|
||||
|
||||
def simpleParser(
|
||||
|
|
@ -188,7 +184,7 @@ object Command {
|
|||
|
||||
def process(command: String, state: State, onParseError: String => Unit): State = {
|
||||
(if (command.contains(";")) parse(command, state.combinedParser)
|
||||
else parse(command, state.nonMultiParser)) match {
|
||||
else parse(command, state.nonMultiParser)) match {
|
||||
case Right(s) => s() // apply command. command side effects happen here
|
||||
case Left(errMsg) =>
|
||||
state.log.error(errMsg)
|
||||
|
|
@ -211,7 +207,9 @@ object Command {
|
|||
maxDistance: Int = 3,
|
||||
maxSuggestions: Int = 3
|
||||
): Seq[String] =
|
||||
bs map (b => (b, distance(a, b))) filter (_._2 <= maxDistance) sortBy (_._2) take (maxSuggestions) map (_._1)
|
||||
bs map (b =>
|
||||
(b, distance(a, b))
|
||||
) filter (_._2 <= maxDistance) sortBy (_._2) take (maxSuggestions) map (_._1)
|
||||
|
||||
def distance(a: String, b: String): Int =
|
||||
EditDistance.levenshtein(
|
||||
|
|
@ -228,11 +226,9 @@ object Command {
|
|||
def spacedAny(name: String): Parser[String] = spacedC(name, any)
|
||||
|
||||
def spacedC(name: String, c: Parser[Char]): Parser[String] =
|
||||
((c & opOrIDSpaced(name)) ~ c.+) map { (f, rem) => (f +: rem).mkString }
|
||||
((c & opOrIDSpaced(name)) ~ c.+) map { (f, rem) => (f +: rem).mkString }
|
||||
}
|
||||
|
||||
// format: on
|
||||
|
||||
trait Help {
|
||||
def detail: Map[String, String]
|
||||
def brief: Seq[(String, String)]
|
||||
|
|
|
|||
|
|
@ -339,8 +339,7 @@ object Scoped:
|
|||
}
|
||||
|
||||
private[sbt] trait Syntax:
|
||||
|
||||
// format: off
|
||||
|
||||
// richInitialize
|
||||
extension [A1](init: Initialize[A1])
|
||||
@targetName("mapTaskInitialize")
|
||||
|
|
@ -348,7 +347,6 @@ object Scoped:
|
|||
|
||||
@targetName("flatMapValueInitialize")
|
||||
def flatMapTaskValue[A2](f: A1 => Task[A2]): Initialize[Task[A2]] = init(f)
|
||||
// format: on
|
||||
|
||||
// richInitializeTask
|
||||
extension [A1](init: Initialize[Task[A1]])
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import scala.quoted.*
|
|||
*/
|
||||
object FileChangesMacro:
|
||||
|
||||
// format: off
|
||||
extension [A](in: TaskKey[A])
|
||||
@compileTimeOnly(
|
||||
"`inputFileChanges` can only be called on a task within a task definition macro, such as :=, +=, ++=, or Def.task."
|
||||
|
|
@ -50,7 +49,7 @@ object FileChangesMacro:
|
|||
)
|
||||
inline def outputFiles: Seq[NioPath] =
|
||||
${ FileChangesMacro.outputFilesImpl[A]('in) }
|
||||
// format: on
|
||||
|
||||
def changedInputFilesImpl[A: Type](in: Expr[TaskKey[A]])(using qctx: Quotes): Expr[FileChanges] =
|
||||
impl[A](
|
||||
in = in,
|
||||
|
|
|
|||
Loading…
Reference in New Issue