CLI: small code refactoring
[Thanks to Damyan Ivanov]
CLI: tiny code refactoring