def complete_path(self, text, state):
        line_beginning = readline.get_line_buffer()[:readline.get_begidx()]
        if "(" not in line_beginning:
            return []

        """ Expand file paths for several functions. """
        candidates = [i for i in KEYKIT_FILE_RELEATED_FUNCTIONS
                      if i[0] in line_beginning]
        if len(candidates) == 0:
            return []

        for candidate in candidates:
            re_split_args = "([^=]*=)?\s*%s\s*\(([^,]+,){%d}" % candidate
            if re.search(re_split_args, line_beginning) is not None:
                # Note that text is to short du the default delims setting.
                text2 = readline.get_line_buffer()
                text2 = text2[text2.rfind('"')+1:]
                return self.shell.update_lsdir(text2, 3)
                break

        return []
    text=textin

    #Complete \t to tabs
    if text[-2:]=='\\t':
        if state==0: return text[:-2]+'\t'
        else: return
        
    prefix=''

    localtables=[]
    completions=[]

    linebuffer=readline.get_line_buffer()

    beforecompl= linebuffer[0:readline.get_begidx()]

    # Only complete '.xxx' completions when space chars exist before completion
    if re.match(r'\s*$', beforecompl):
        completions+=dotcompletions
    # If at the start of the line, show all tables
    if beforecompl=='' and text=='':
        localtables=alltables[:]

        # Check if all tables start with the same character
        if localtables!=[]:
            prefcharset=set( (x[0] for x in localtables) )
            if len(prefcharset)==1:
                localtables+=[' ']
        completions=localtables
    # If completion starts at a string boundary, complete from local dir
Exemple #3
0
    # Complete \t to tabs
    if text[-2:] == '\\t':
        if state == 0:
            return text[:-2] + '\t'
        else:
            return

    prefix = ''

    localtables = []
    completions = []

    linebuffer = readline.get_line_buffer()

    beforecompl = linebuffer[0:readline.get_begidx()]

    # Only complete '.xxx' completions when space chars exist before completion
    if re.match(r'\s*$', beforecompl):
        completions += dotcompletions
    # If at the start of the line, show all tables
    if beforecompl == '' and text == '':
        localtables = alltables[:]

        # Check if all tables start with the same character
        if localtables != []:
            prefcharset = set((x[0] for x in localtables))
            if len(prefcharset) == 1:
                localtables += [' ']
        completions = localtables
    # If completion starts at a string boundary, complete from local dir