diff --git a/CHANGELOG.md b/CHANGELOG.md index bd02575ae..3f2b8411f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Deprecated +- Deprecated calling `echo` with `err` or `lineSeparator` but no `message`. + + ## 3.0.0 _2020-09-02_ diff --git a/clikt/src/commonMain/kotlin/com/github/ajalt/clikt/core/CliktCommand.kt b/clikt/src/commonMain/kotlin/com/github/ajalt/clikt/core/CliktCommand.kt index 9c28d21d2..cc369c611 100644 --- a/clikt/src/commonMain/kotlin/com/github/ajalt/clikt/core/CliktCommand.kt +++ b/clikt/src/commonMain/kotlin/com/github/ajalt/clikt/core/CliktCommand.kt @@ -3,6 +3,7 @@ package com.github.ajalt.clikt.core import com.github.ajalt.clikt.completion.CompletionGenerator import com.github.ajalt.clikt.mpp.exitProcessMpp import com.github.ajalt.clikt.mpp.readEnvvar +import com.github.ajalt.clikt.output.CliktConsole import com.github.ajalt.clikt.output.HelpFormatter.ParameterHelp import com.github.ajalt.clikt.output.TermUi import com.github.ajalt.clikt.parameters.arguments.Argument @@ -243,8 +244,17 @@ abstract class CliktCommand( */ open fun aliases(): Map> = emptyMap() - /** Prints [lineSeparator] to `stdout`, or to `stderr` if [err] is true */ - protected fun echo(err: Boolean = false, lineSeparator: String = currentContext.console.lineSeparator) { + /** Print the default [line separator][CliktConsole.lineSeparator] to `stdout` */ + protected fun echo() { + echo("") + } + + @Deprecated( + message="Specify message explicitly with `err` or `lineSeparator`", + replaceWith = ReplaceWith("echo(\"\", err=err, lineSeparator=lineSeparator)") + ) + /** @suppress */ + protected fun echo(err: Boolean, lineSeparator: String ) { echo("", err = err, lineSeparator = lineSeparator) }