def completenames(self, text, line, begidx, endidx): ''' This is called to automatically complete the commands on the cli ''' if not line: # The user didn't enter anything. Show the basics. output = command_ref.ALL_MODIFIERS + ['help', 'quit'] output.sort() return output else: return self.completedefault(text, line, begidx, endidx)
def completenames(self, text, line, begidx, endidx): """ This is called to automatically complete the commands on the cli """ if not line: # The user didn't enter anything. Show the basics. output = command_ref.ALL_MODIFIERS + ["help", "quit"] output.sort() return output else: return self.completedefault(text, line, begidx, endidx)
def completedefault(self, text, line, begidx, endidx): """ This shows the list in case , the auto complete is not able to complete the full command. """ completed_portion = line[:begidx] completed_tokens = vps_cli.cmd_tokenize(completed_portion, cmd_line_complete=False) output = command_ref.cmdCompletion(completed_tokens, text) if not output: output = [text] output.sort() return output