def get_completion_suggestions(self, action, text, line, **kwargs): if action.dest == "server": return ["localhost:31415"] elif action.dest == "file": return path_completion.complete(text) elif action.dest == "resource": return ["/view.jsp"]
def get_completion_suggestions(self, action, text, **kwargs): if action.dest == "server": return ["localhost:31415"] elif action.dest == "file": return path_completion.complete(text) elif action.dest == "device": return None elif action.dest == "onecmd": return None
def get_completion_suggestions(self, action, text, line, **kwargs): if action.dest == "server": return ["localhost:31415"] elif action.dest == "file": return path_completion.complete(text) elif action.dest == "device": return None elif action.dest == "onecmd": return None
def __get_suggestions_for(self, action, text, line, **kwargs): """ Calculate suggestions for a particular action, given some initial text. Where possible, this method provides the suggestions itself, otherwise it defers to the suggestion provider. """ if action.choices != None: # this is pick-from-a-list suggestions = action.choices elif isinstance(action.type, argparse.FileType): # this is local path completion suggestions = path_completion.complete(text) else: # we don't know, defer to the provider suggestions = self.provider.get_completion_suggestions(action, text, line, **kwargs) if suggestions != None: return suggestions else: return []