Skip to content

Fix arguments parsing in the main function

Rafał Mikrut requested to merge github/fork/akien-mga/parameters-parsing into master

Created by: akien-mga

Fixes #2611 (closed) which was a regression from 692216b86ab97db91e7ff3903ffc9ac8e37433f6. The bogus behaviour considered that if there were more than one arguments left to parse, they would be a pair of arguments (switch and its parameter), and thus skipped the next argument in all cases (thus potentially skipping a "-editor", which triggered #2611 (closed)).

This is fixed by checking first for arguments that don't expect a parameter, and only afterwards for arguments that expect a parameter. And if a "pair" of arguments is not valid, we no longer increment the counter.

Merge request reports