I used to be able to type the following:
$> ./foo --arg=
Where foo is any program I wrote, and it would give me a list of files in the current dir
I resolved the same trouble with Ubuntu 12.04 by using https://github.com/ai/rake-completion. You need to
wget -O ~/scripts/rake https://raw.githubusercontent.com/ai/rake-completion/master/rake
. ~/scripts/rake
or You can use one of other ways on that page.