Add method overload to keep binary compatibility

This commit is contained in:
Iulian Dragos
2023-08-08 09:54:09 +02:00
parent 82ae293e3f
commit 0f53349ce9
2 changed files with 14 additions and 6 deletions
@@ -184,7 +184,9 @@ object Command {
}
)
def process(command: String, state: State, onParseError: String => Unit = _ => ()): State = {
// overload instead of default parameter to keep binary compatibility
def process(command: String, state: State): State = process(command, state, _ => ())
def process(command: String, state: State, onParseError: String => Unit): State = {
(if (command.contains(";")) parse(command, state.combinedParser)
else parse(command, state.nonMultiParser)) match {
case Right(s) => s() // apply command. command side effects happen here