Move out the argument parser creation into functions

This makes the main function much simpler. There is still more work to
be done for making the argparse creation & handling of actions much
easier.