Python, through this readline binding, allows excellent command line completion (as described here ).
But it seems that only the shutdown works at the beginning of the lines. If you want to align the middle or end of a line, then readline does not work.
I would like to autocomplete strings on the python command line, matching what I'm typing with any of the strings in the list of available strings.
- A good example of the type of autocomplete that I would like to have is the type that appears in GMail when you type in the To field. If you type one of your last names, it will appear just as if you had typed her name.
- Some use of the up and down arrows or some other method to select from consistent lines may be necessary (and not required in the case of readline), and this is good in my case.
- My specific use case is a command line program that sends emails.
- Specific code examples will be very helpful.
Using terminal emulators like curses would be nice. It should work only on Linux, not on Mac or Windows.
Here is an example: Let's say I have the following three lines in a list
['Paul Eden < paul@domain.com >', 'Eden Jones < ejones@domain.com >', 'Somebody Else < somebody@domain.com >']
I need some code that will autocomplete the first two items in the list after entering "Eden", and then let me select one of them (all through the command line using the keyboard).
python command-line linux unix autocomplete
Paul D. Eden
source share