Add tabcompletion support

Add proper tabcompletion support. Most work is code cleanup and adding unittests.
Just wondering if it wouldn't be better to use `Template::Toolkit` for formatting these outputs?