mirror of
https://github.com/apple/pkl.git
synced 2026-04-11 03:06:55 +02:00
Improve Formatter API (#1505)
- pass `GrammarVersion` to constructor instead of passing it to each `format` method - replace `format(Path): String` with `format(Reader, Appendable)` - instead of picking which overloads besides `format(String): String` might be useful, offer a single generalized method that streams input and output - add `@Throws(IOException::class)` to ensure that Java callers can catch this exception - deprecate old methods
This commit is contained in:
@@ -47,7 +47,7 @@ constructor(
|
||||
private val errWriter: Writer = System.err.writer(),
|
||||
) : CliCommand(CliBaseOptions()) {
|
||||
private fun format(contents: String): String {
|
||||
return Formatter().format(contents, grammarVersion)
|
||||
return Formatter(grammarVersion).format(contents)
|
||||
}
|
||||
|
||||
private fun writeErrLine(error: String) {
|
||||
|
||||
Reference in New Issue
Block a user