[CalendarServer-changes] [8455] CalendarServer/trunk/calendarserver/tools/shell.py

source_changes at macosforge.org source_changes at macosforge.org
Thu Dec 15 14:34:21 PST 2011


Revision: 8455
          http://trac.macosforge.org/projects/calendarserver/changeset/8455
Author:   wsanchez at apple.com
Date:     2011-12-15 14:34:20 -0800 (Thu, 15 Dec 2011)
Log Message:
-----------
Print completion options

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/shell.py

Modified: CalendarServer/trunk/calendarserver/tools/shell.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/shell.py	2011-12-15 19:06:19 UTC (rev 8454)
+++ CalendarServer/trunk/calendarserver/tools/shell.py	2011-12-15 22:34:20 UTC (rev 8455)
@@ -226,20 +226,25 @@
             completions = m(tokens)
         else:
             # Completing command name
+            word = cmd
 
             completions = set()
             for name, m in self.commands():
-                if name.startswith(cmd):
-                    completions.add(name[len(cmd):])
+                if name.startswith(word):
+                    completions.add(name[len(word):])
 
         if len(completions) == 1:
-            for word in completions:
+            for completion in completions:
                 break
-            for c in word:
+            for c in completion:
                 self.characterReceived(c, True)
             self.characterReceived(" ", False)
         else:
-            log.msg("TAB: %r :: %r" % ("".join(self.lineBuffer), completions))
+            self.terminal.nextLine()
+            for completion in completions:
+                # FIXME Emitting these in columns would be swell
+                self.terminal.write("%s%s\n" % (word, completion))
+            self.drawInputLine()
 
     def exit(self):
         self.terminal.loseConnection()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20111215/903a8b6d/attachment.html>


More information about the calendarserver-changes mailing list