Add completion to ls in CapCollection

The completion is the same code as ls used to call.
This commit is contained in:
theo 2012-03-20 01:19:57 +01:00 committed by Romain Bignon
commit 67ae0893cd

View file

@ -949,7 +949,8 @@ class ReplApplication(Cmd, ConsoleApplication):
obj_collections = [obj for obj in self.objects if isinstance(obj, BaseCollection)]
return obj_collections + self.collections
def complete_cd(self, text, line, begidx, endidx):
# for cd & ls
def complete_path(self, text, line, begidx, endidx):
directories = set()
if len(self.working_path.get()):
directories.add('..')
@ -973,6 +974,12 @@ class ReplApplication(Cmd, ConsoleApplication):
return [s[offs:] for s in directories if s.startswith(mline)]
def complete_ls(self, text, line, begidx, endidx):
return self.complete_path(text, line, begidx, endidx)
def complete_cd(self, text, line, begidx, endidx):
return self.complete_path(text, line, begidx, endidx)
# -- formatting related methods -------------
def set_formatter(self, name):
"""