command pattern in Scala