Returns command trees for multiple lines

TODO: fix errors in test cases