toejough / pimento

simple CLI menu

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add tab completion

toejough opened this issue · comments

thought I could use the cmd module, or the readline module. cmd uses readline. readline is unix-only, which isn't so bad, but it also requires the use of "input", which is not python 2 compatible. (it's raw_input in python2). That's work-aroundable, but both functions (input/raw_input) print the prompt to stdout, and I want the user to be able to control that. In particular, an aim is to by default print to stderr, so that the user can print just the result to stdout for piping or logging purposes. I'm trying to keep the interactive stuff on stderr by default.

This is possible, via the solution posted at here, which is basically swapping sys.stderr and sys.stdout for your function call.

Looks like there are a few quirks to work around before I'm ready with this feature.

fixed in 04b41cc, but that had a bad commit message.