Add completion to ls in CapCollection
The completion is the same code as ls used to call.
This commit is contained in:
parent
65d450860e
commit
67ae0893cd
1 changed files with 8 additions and 1 deletions
|
|
@ -949,7 +949,8 @@ class ReplApplication(Cmd, ConsoleApplication):
|
||||||
obj_collections = [obj for obj in self.objects if isinstance(obj, BaseCollection)]
|
obj_collections = [obj for obj in self.objects if isinstance(obj, BaseCollection)]
|
||||||
return obj_collections + self.collections
|
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()
|
directories = set()
|
||||||
if len(self.working_path.get()):
|
if len(self.working_path.get()):
|
||||||
directories.add('..')
|
directories.add('..')
|
||||||
|
|
@ -973,6 +974,12 @@ class ReplApplication(Cmd, ConsoleApplication):
|
||||||
|
|
||||||
return [s[offs:] for s in directories if s.startswith(mline)]
|
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 -------------
|
# -- formatting related methods -------------
|
||||||
def set_formatter(self, name):
|
def set_formatter(self, name):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue