generalises CLI interface and updates doc