command patter in Scala