added more sophisticated readline command expansion