Generalize command execution

Build a map of commands to their execution functions, and use the
command line argument to run a given command.