MCPcopy
hub / github.com/RUB-NDS/PRET / complete_lfiles

Method complete_lfiles

printer.py:615–629  ·  view source on GitHub ↗
(self, text, line, begidx, endidx)

Source from the content-addressed store, hash-verified

613 # --------------------------------------------------------------------
614 # auto-complete dirlist for local fs
615 def complete_lfiles(self, text, line, begidx, endidx):
616 before_arg = line.rfind(" ", 0, begidx)
617 if before_arg == -1:
618 return # arg not found
619
620 fixed = line[before_arg + 1: begidx] # fixed portion of the arg
621 arg = line[before_arg + 1: endidx]
622 pattern = arg + "*"
623
624 completions = []
625 for path in glob.glob(pattern):
626 if path and os.path.isdir(path) and path[-1] != os.sep:
627 path = path + os.sep
628 completions.append(path.replace(fixed, "", 1))
629 return completions
630
631 # define alias
632 complete_load = complete_lfiles # files or directories

Callers

nothing calls this directly

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected