Refactor command-line parsing

Refactor command-line parsing to better utilize GOptionContext, similar to recent changes to OSTree.

The "rpm" command needed extra attention, so I split that out in a separate commit.  However the installed tests don't cover that command, so some additional testing would be appreciated there.

The last commit is just some tangential cleanup.