Refactor the argument parser used by powerline

Make the argument parser part of the powerline module so it can be
re-used in the daemon process.