Help on arbitrary number of subcommands

Replace conditional statement with each_index block to generate output command
This is a more scalable implementation of pull request #25