Refactored the subcommand system.

Each subcommand is now its own struct and implements the subcmd.Command
interface.