Rewrite commandLineOptions()

I think the code is now cleaner in general, and it also has additional
features: Omitting the value for boolean options should always work
(previously didn’t work if it was the last option), and unknown options
are returned in the remaining items, together with the file paths, which
will allow for #44.

Also, a test!