Abstract out the readline-centric functionality into a separate utility.