fix TemplateBasedCompleter to work with commands
cleanup