Make small parseopts refactoring

* Use cmd_name instead of args_else[0] for clarity and consistency with
other code
* Move cmd_args assignment to place where it used
Merge pull request #1768 from evvers/small-parseopts-refactoring

Small parseopts refactoring