refactoring bash completation script