extract command dispatcher to cli.ls.