I am looking to make a autocomplete based on index, so each argument has its own autocomplete for example
PROMPT> use stackoverflow
therefore use would have its own autocomplete and so would stackoverflow I know this is possible as empire did it and ive tried things like readline, prompt_toolkit and suggestions?
This can be completed with the cmd module take a look
class CmdTemplate(cmd.Cmd):
def __init__(self, wordlist, prompt):
self.wordlist = wordlist
self.prompt = prompt
super(CmdTemplate, self).__init__()
def do_c2(self, line):
pass
def complete_c2(self, text, line, start_index, end_index):
if text:
return [
words for words in wordlist
if words.startswith(text)
]
else:
return wordlist
do_ means the main command and complete_ autocompletes it, good luck