cli: change while to for in keyword argument processing