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

source_changes at macosforge.org source_changes at macosforge.org
Mon Apr 9 17:07:42 PDT 2012


Revision: 9000
          http://trac.macosforge.org/projects/calendarserver/changeset/9000
Author:   wsanchez at apple.com
Date:     2012-04-09 17:07:41 -0700 (Mon, 09 Apr 2012)
Log Message:
-----------
Reorder to taste

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

Modified: CalendarServer/trunk/calendarserver/tools/shell/cmd.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/shell/cmd.py	2012-04-09 23:27:13 UTC (rev 8999)
+++ CalendarServer/trunk/calendarserver/tools/shell/cmd.py	2012-04-10 00:07:41 UTC (rev 9000)
@@ -118,6 +118,22 @@
     Data store commands.
     """
 
+    #
+    # Basic CLI tools
+    #
+
+    def cmd_exit(self, tokens):
+        """
+        Exit the shell.
+
+        usage: exit
+        """
+        if tokens:
+            raise UnknownArguments(tokens)
+
+        self.exit()
+
+
     def cmd_help(self, tokens):
         """
         Show help.
@@ -233,6 +249,42 @@
             return ()
 
 
+    def cmd_log(self, tokens):
+        """
+        Enable logging.
+
+        usage: log [file]
+        """
+        if hasattr(self, "_logFile"):
+            self.terminal.write("Already logging to file: %s\n" % (self._logFile,))
+            return
+
+        if tokens:
+            fileName = tokens.pop(0)
+        else:
+            fileName = "/tmp/shell.log"
+
+        if tokens:
+            raise UnknownArguments(tokens)
+
+        from twisted.python.log import startLogging
+        try:
+            f = open(fileName, "w")
+        except (IOError, OSError), e:
+            self.terminal.write("Unable to open file %s: %s\n" % (fileName, e))
+            return
+
+        startLogging(f)
+
+        self._logFile = fileName
+
+    cmd_log.hidden = "Debug tool"
+
+
+    #
+    # Filesystem tools
+    #
+
     def cmd_pwd(self, tokens):
         """
         Print working folder.
@@ -340,18 +392,10 @@
     complete_cat = CommandsBase.complete_files
 
 
-    def cmd_exit(self, tokens):
-        """
-        Exit the shell.
+    #
+    # Python prompt, for the win
+    #
 
-        usage: exit
-        """
-        if tokens:
-            raise UnknownArguments(tokens)
-
-        self.exit()
-
-
     def cmd_python(self, tokens):
         """
         Switch to a python prompt.
@@ -413,6 +457,10 @@
             self.drawInputLine()
 
 
+    #
+    # SQL prompt, for not as winning
+    #
+
     def cmd_sql(self, tokens):
         """
         Switch to an SQL prompt.
@@ -425,35 +473,3 @@
         raise NotImplementedError("")
 
     cmd_sql.hidden = "Not implemented."
-
-
-    def cmd_log(self, tokens):
-        """
-        Enable logging.
-
-        usage: log [file]
-        """
-        if hasattr(self, "_logFile"):
-            self.terminal.write("Already logging to file: %s\n" % (self._logFile,))
-            return
-
-        if tokens:
-            fileName = tokens.pop(0)
-        else:
-            fileName = "/tmp/shell.log"
-
-        if tokens:
-            raise UnknownArguments(tokens)
-
-        from twisted.python.log import startLogging
-        try:
-            f = open(fileName, "w")
-        except (IOError, OSError), e:
-            self.terminal.write("Unable to open file %s: %s\n" % (fileName, e))
-            return
-
-        startLogging(f)
-
-        self._logFile = fileName
-
-    cmd_log.hidden = "Debug tool"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120409/7947b966/attachment.html>


More information about the calendarserver-changes mailing list