Add tabcompletion support

Add proper tabcompletion support. Most work is code cleanup and adding unittests.
Are the authors still mentioned somewhere? I don't think we can suppress them...