Rework command-line parsing

Use dictionary-like objects for options and arguments.