Refactor normalize_cmdline_options() for better style and test coverage