split command prompt and completion into parts

simplifies handling and allows extension