Weird behaviour with optparse and bash tab completion
- by PulpFiction
Hi
I am building a script for users new to Linux, so please understand why I am asking this :)
My script runs like this:
python script.py -f filename.txt
I am using the optparse module for this. However, I noticed the following when doing tab completion.
The tab completion works when I do:
python script.py <tab completion> # Tab completion works normally as expected
But it does not work when I do it like this:
python script.py -f <tab completion> # No type of tab completion works here.
I really don't want my users typing the name of the input file. Tab completion is a must. How can I get it working or what am I doing wrong here?