[CalendarServer-changes] [14856] CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/ recovertrash.py

source_changes at macosforge.org source_changes at macosforge.org
Fri May 29 09:32:46 PDT 2015


Revision: 14856
          http://trac.calendarserver.org//changeset/14856
Author:   cdaboo at apple.com
Date:     2015-05-29 09:32:45 -0700 (Fri, 29 May 2015)
Log Message:
-----------
Better help and arg checking.

Modified Paths:
--------------
    CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/recovertrash.py

Modified: CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/recovertrash.py
===================================================================
--- CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/recovertrash.py	2015-05-29 14:28:27 UTC (rev 14855)
+++ CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/recovertrash.py	2015-05-29 16:32:45 UTC (rev 14856)
@@ -42,7 +42,7 @@
         mode = "event"
         opts, args = getopt.getopt(shlex.split(options), "c")
 
-        for name, value in opts:
+        for name, _ignore_value in opts:
 
             if name == "-c":
                 mode = "collection"
@@ -51,6 +51,11 @@
                 print self.usage(cmdname)
                 raise WrongOptions
 
+        if len(args) == 0:
+            print "Arguments must be supplied"
+            print self.usage(cmdname)
+            raise WrongOptions
+
         for recoveryID in args:
             resource = URL(url="{}?action=recovertrash&mode={}&id={}".format(homepath, mode, recoveryID))
             self.shell.account.session.writeData(resource, None, None, method="POST")
@@ -59,7 +64,12 @@
 
 
     def usage(self, name):
-        return """Usage: %s
+        return """Usage: %s [OPTIONS] RID1, ...
+RIDx are recovery IDs.
+
+Options:
+-c    recover a collection
+
 """ % (name,)
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150529/eff7bb70/attachment.html>


More information about the calendarserver-changes mailing list