-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1530 from scala-steward/update/metaconfig-docs-0.…
…10.0 Update metaconfig-docs to 0.10.0
- Loading branch information
Showing
7 changed files
with
96 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
scalafix-cli/src/main/scala-2.11/scalafix/internal/v1/TPrintImplicits.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package scalafix.internal.v1 | ||
|
||
import java.nio.file.PathMatcher | ||
|
||
import scala.meta.io.AbsolutePath | ||
|
||
import metaconfig.Conf | ||
import pprint.TPrint | ||
import scalafix.internal.config.ScalafixConfig | ||
|
||
class TPrintImplicits { | ||
implicit val absolutePathPrint: TPrint[AbsolutePath] = | ||
TPrint.make[AbsolutePath](_ => "<path>") | ||
implicit val pathMatcherPrint: TPrint[PathMatcher] = | ||
TPrint.make[PathMatcher](_ => "<glob>") | ||
implicit val confPrint: TPrint[Conf] = | ||
TPrint.make[Conf](implicit cfg => TPrint.implicitly[ScalafixConfig].render) | ||
|
||
implicit def optionPrint[T](implicit | ||
ev: pprint.TPrint[T] | ||
): TPrint[Option[T]] = | ||
TPrint.make { implicit cfg => | ||
ev.render | ||
} | ||
implicit def iterablePrint[C[x] <: Iterable[x], T](implicit | ||
ev: pprint.TPrint[T] | ||
): TPrint[C[T]] = | ||
TPrint.make { implicit cfg => | ||
s"[${ev.render} ...]" | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
scalafix-cli/src/main/scala-2.12+/scalafix/internal/v1/TPrintImplicits.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package scalafix.internal.v1 | ||
|
||
import java.nio.file.PathMatcher | ||
|
||
import scala.meta.io.AbsolutePath | ||
|
||
import metaconfig.Conf | ||
import metaconfig.pprint._ | ||
import scalafix.internal.config.ScalafixConfig | ||
|
||
class TPrintImplicits { | ||
implicit val absolutePathPrint: TPrint[AbsolutePath] = | ||
new TPrint[AbsolutePath] { | ||
def render(implicit tpc: TPrintColors): fansi.Str = fansi.Str("<path>") | ||
} | ||
|
||
implicit val pathMatcherPrint: TPrint[PathMatcher] = | ||
new TPrint[PathMatcher] { | ||
def render(implicit tpc: TPrintColors): fansi.Str = fansi.Str("<glob>") | ||
} | ||
|
||
implicit val confPrint: TPrint[Conf] = | ||
new TPrint[Conf] { | ||
def render(implicit tpc: TPrintColors): fansi.Str = | ||
TPrint.implicitly[ScalafixConfig].render | ||
} | ||
|
||
implicit def optionPrint[T](implicit ev: TPrint[T]): TPrint[Option[T]] = | ||
new TPrint[Option[T]] { | ||
def render(implicit tpc: TPrintColors): fansi.Str = ev.render | ||
} | ||
|
||
implicit def iterablePrint[C[x] <: Iterable[x], T](implicit | ||
ev: TPrint[T] | ||
): TPrint[C[T]] = | ||
new TPrint[C[T]] { | ||
def render(implicit tpc: TPrintColors): fansi.Str = s"[${ev.render} ...]" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters