HOSTDEV-767 rewrite of the cli, now well tested