How can I implement a REPL for an existing, non-interactive CLI utility?