properly flush input buffer in cli