[CalendarServer-changes] [8462] CalendarServer/trunk/calendarserver/tools/shell.py
source_changes at macosforge.org
source_changes at macosforge.org
Thu Dec 15 16:20:52 PST 2011
Revision: 8462
http://trac.macosforge.org/projects/calendarserver/changeset/8462
Author: wsanchez at apple.com
Date: 2011-12-15 16:20:51 -0800 (Thu, 15 Dec 2011)
Log Message:
-----------
Complete cd
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/shell.py
Modified: CalendarServer/trunk/calendarserver/tools/shell.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/shell.py 2011-12-16 00:10:44 UTC (rev 8461)
+++ CalendarServer/trunk/calendarserver/tools/shell.py 2011-12-16 00:20:51 UTC (rev 8462)
@@ -212,6 +212,7 @@
def handle_QUIT(self):
self.exit()
+ @inlineCallbacks
def handle_TAB(self):
# Tokenize the text before the cursor
tokens = self.tokenize("".join(self.lineBuffer[:self.lineBufferIndex]))
@@ -231,7 +232,7 @@
m = getattr(self, "complete_%s" % (cmd,), None)
if not m:
return
- completions = tuple(m(tokens))
+ completions = tuple((yield m(tokens)))
log.msg("COMPLETIONS: %r" % (completions,))
else:
@@ -518,6 +519,21 @@
self.wd = wd
@inlineCallbacks
+ def complete_cd(self, tokens):
+ directories = (
+ item[1]
+ for item in (yield self.wd.list())
+ if issubclass(item[0], Folder)
+ )
+
+ if len(tokens) == 0:
+ returnValue(directories)
+ elif len(tokens) == 1:
+ returnValue(self._complete(tokens[0], directories))
+ else:
+ returnValue(())
+
+ @inlineCallbacks
def cmd_ls(self, tokens):
"""
List folder contents.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20111215/b5dd3f5f/attachment.html>
More information about the calendarserver-changes
mailing list