[CalendarServer-changes] [5539] CalDAVClientLibrary/trunk/src/browser/commands

source_changes at macosforge.org source_changes at macosforge.org
Wed Apr 28 09:22:25 PDT 2010


Revision: 5539
          http://trac.macosforge.org/projects/calendarserver/changeset/5539
Author:   cdaboo at apple.com
Date:     2010-04-28 09:22:20 -0700 (Wed, 28 Apr 2010)
Log Message:
-----------
Better command line parsing.

Modified Paths:
--------------
    CalDAVClientLibrary/trunk/src/browser/commands/acl.py
    CalDAVClientLibrary/trunk/src/browser/commands/cat.py
    CalDAVClientLibrary/trunk/src/browser/commands/cd.py
    CalDAVClientLibrary/trunk/src/browser/commands/help.py
    CalDAVClientLibrary/trunk/src/browser/commands/logging.py
    CalDAVClientLibrary/trunk/src/browser/commands/ls.py
    CalDAVClientLibrary/trunk/src/browser/commands/mkcal.py
    CalDAVClientLibrary/trunk/src/browser/commands/mkdir.py
    CalDAVClientLibrary/trunk/src/browser/commands/mv.py
    CalDAVClientLibrary/trunk/src/browser/commands/principal.py
    CalDAVClientLibrary/trunk/src/browser/commands/props.py
    CalDAVClientLibrary/trunk/src/browser/commands/proxies.py
    CalDAVClientLibrary/trunk/src/browser/commands/put.py
    CalDAVClientLibrary/trunk/src/browser/commands/rm.py

Modified: CalDAVClientLibrary/trunk/src/browser/commands/acl.py
===================================================================
--- CalDAVClientLibrary/trunk/src/browser/commands/acl.py	2010-04-27 20:51:51 UTC (rev 5538)
+++ CalDAVClientLibrary/trunk/src/browser/commands/acl.py	2010-04-28 16:22:20 UTC (rev 5539)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2007-2008 Apple Inc. All rights reserved.
+# Copyright (c) 2007-2010 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@
 import readline
 import os
 import getopt
+import shlex
 
 class Cmd(Command):
     
@@ -41,7 +42,7 @@
         path = None
 
         try:
-            opts, args = getopt.getopt(options.split(), 'i')
+            opts, args = getopt.getopt(shlex.split(options), 'i')
         except getopt.GetoptError, e:
             print str(e)
             print self.usage(name)

Modified: CalDAVClientLibrary/trunk/src/browser/commands/cat.py
===================================================================
--- CalDAVClientLibrary/trunk/src/browser/commands/cat.py	2010-04-27 20:51:51 UTC (rev 5538)
+++ CalDAVClientLibrary/trunk/src/browser/commands/cat.py	2010-04-28 16:22:20 UTC (rev 5539)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2007-2008 Apple Inc. All rights reserved.
+# Copyright (c) 2007-2010 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
 from protocol.url import URL
 import os
 import getopt
+import shlex
 
 class Cmd(Command):
     
@@ -27,7 +28,7 @@
         self.cmds = ("cat",)
         
     def execute(self, name, options):
-        opts, args = getopt.getopt(options.split(), '')
+        opts, args = getopt.getopt(shlex.split(options), '')
         if len(opts) or len(args) != 1:
             print self.usage(name)
             raise WrongOptions()

Modified: CalDAVClientLibrary/trunk/src/browser/commands/cd.py
===================================================================
--- CalDAVClientLibrary/trunk/src/browser/commands/cd.py	2010-04-27 20:51:51 UTC (rev 5538)
+++ CalDAVClientLibrary/trunk/src/browser/commands/cd.py	2010-04-28 16:22:20 UTC (rev 5539)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2007-2008 Apple Inc. All rights reserved.
+# Copyright (c) 2007-2010 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
 from browser.command import WrongOptions
 import os
 import getopt
+import shlex
 
 class Cmd(Command):
     
@@ -26,7 +27,7 @@
         self.cmds = ("cd",)
         
     def execute(self, name, options):
-        opts, args = getopt.getopt(options.split(), '')
+        opts, args = getopt.getopt(shlex.split(options), '')
         if len(opts) or len(args) != 1:
             print self.usage(name)
             raise WrongOptions()

Modified: CalDAVClientLibrary/trunk/src/browser/commands/help.py
===================================================================
--- CalDAVClientLibrary/trunk/src/browser/commands/help.py	2010-04-27 20:51:51 UTC (rev 5538)
+++ CalDAVClientLibrary/trunk/src/browser/commands/help.py	2010-04-28 16:22:20 UTC (rev 5539)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2007-2008 Apple Inc. All rights reserved.
+# Copyright (c) 2007-2010 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
 from browser.command import Command
 from browser.command import WrongOptions
 import getopt
+import shlex
 
 class Cmd(Command):
     
@@ -25,7 +26,7 @@
         self.cmds = ("help", "?",)
         
     def execute(self, name, options):
-        opts, args = getopt.getopt(options.split(), '')
+        opts, args = getopt.getopt(shlex.split(options), '')
         if len(opts) or len(args) > 1:
             print self.usage(name)
             raise WrongOptions()

Modified: CalDAVClientLibrary/trunk/src/browser/commands/logging.py
===================================================================
--- CalDAVClientLibrary/trunk/src/browser/commands/logging.py	2010-04-27 20:51:51 UTC (rev 5538)
+++ CalDAVClientLibrary/trunk/src/browser/commands/logging.py	2010-04-28 16:22:20 UTC (rev 5539)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2007-2008 Apple Inc. All rights reserved.
+# Copyright (c) 2007-2010 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
 from browser.command import Command
 from browser.command import WrongOptions
 import getopt
+import shlex
 
 class Cmd(Command):
     
@@ -25,7 +26,7 @@
         self.cmds = ("logging", )
         
     def execute(self, name, options):
-        opts, args = getopt.getopt(options.split(), '')
+        opts, args = getopt.getopt(shlex.split(options), '')
         if len(opts) or len(args) > 1:
             print self.usage(name)
             raise WrongOptions()

Modified: CalDAVClientLibrary/trunk/src/browser/commands/ls.py
===================================================================
--- CalDAVClientLibrary/trunk/src/browser/commands/ls.py	2010-04-27 20:51:51 UTC (rev 5538)
+++ CalDAVClientLibrary/trunk/src/browser/commands/ls.py	2010-04-28 16:22:20 UTC (rev 5539)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2007-2008 Apple Inc. All rights reserved.
+# Copyright (c) 2007-2010 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
 from protocol.url import URL
 import os
 import getopt
+import shlex
 
 class Cmd(Command):
     
@@ -32,7 +33,7 @@
         longlist = False
         path = None
 
-        opts, args = getopt.getopt(options.split(), 'l')
+        opts, args = getopt.getopt(shlex.split(options), 'l')
 
         for name, _ignore_value in opts:
             

Modified: CalDAVClientLibrary/trunk/src/browser/commands/mkcal.py
===================================================================
--- CalDAVClientLibrary/trunk/src/browser/commands/mkcal.py	2010-04-27 20:51:51 UTC (rev 5538)
+++ CalDAVClientLibrary/trunk/src/browser/commands/mkcal.py	2010-04-28 16:22:20 UTC (rev 5539)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2007-2008 Apple Inc. All rights reserved.
+# Copyright (c) 2007-2010 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
 from protocol.url import URL
 import getopt
 import os
+import shlex
 
 class Cmd(Command):
     
@@ -28,7 +29,7 @@
         
     def execute(self, name, options):
 
-        opts, args = getopt.getopt(options.split(), '')
+        opts, args = getopt.getopt(shlex.split(options), '')
 
         for name, _ignore_value in opts:
             

Modified: CalDAVClientLibrary/trunk/src/browser/commands/mkdir.py
===================================================================
--- CalDAVClientLibrary/trunk/src/browser/commands/mkdir.py	2010-04-27 20:51:51 UTC (rev 5538)
+++ CalDAVClientLibrary/trunk/src/browser/commands/mkdir.py	2010-04-28 16:22:20 UTC (rev 5539)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2007-2008 Apple Inc. All rights reserved.
+# Copyright (c) 2007-2010 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
 from protocol.url import URL
 import getopt
 import os
+import shlex
 
 class Cmd(Command):
     
@@ -28,7 +29,7 @@
         
     def execute(self, name, options):
 
-        opts, args = getopt.getopt(options.split(), '')
+        opts, args = getopt.getopt(shlex.split(options), '')
 
         for name, _ignore_value in opts:
             

Modified: CalDAVClientLibrary/trunk/src/browser/commands/mv.py
===================================================================
--- CalDAVClientLibrary/trunk/src/browser/commands/mv.py	2010-04-27 20:51:51 UTC (rev 5538)
+++ CalDAVClientLibrary/trunk/src/browser/commands/mv.py	2010-04-28 16:22:20 UTC (rev 5539)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2007-2008 Apple Inc. All rights reserved.
+# Copyright (c) 2007-2010 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
 import getopt
 import os
 import readline
+import shlex
 
 class Cmd(Command):
     
@@ -29,7 +30,7 @@
         
     def execute(self, name, options):
 
-        opts, args = getopt.getopt(options.split(), 'n')
+        opts, args = getopt.getopt(shlex.split(options), 'n')
 
         doURLDecode = False
         for name, _ignore_value in opts:

Modified: CalDAVClientLibrary/trunk/src/browser/commands/principal.py
===================================================================
--- CalDAVClientLibrary/trunk/src/browser/commands/principal.py	2010-04-27 20:51:51 UTC (rev 5538)
+++ CalDAVClientLibrary/trunk/src/browser/commands/principal.py	2010-04-28 16:22:20 UTC (rev 5539)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2007-2008 Apple Inc. All rights reserved.
+# Copyright (c) 2007-2010 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
 from protocol.url import URL
 from browser import utils
 import getopt
+import shlex
 
 class Cmd(Command):
     
@@ -32,7 +33,7 @@
         principal = None
         print_proxies = False
 
-        opts, args = getopt.getopt(options.split(), 'fnp:x')
+        opts, args = getopt.getopt(shlex.split(options), 'fnp:x')
 
         for name, value in opts:
             

Modified: CalDAVClientLibrary/trunk/src/browser/commands/props.py
===================================================================
--- CalDAVClientLibrary/trunk/src/browser/commands/props.py	2010-04-27 20:51:51 UTC (rev 5538)
+++ CalDAVClientLibrary/trunk/src/browser/commands/props.py	2010-04-28 16:22:20 UTC (rev 5539)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2007-2008 Apple Inc. All rights reserved.
+# Copyright (c) 2007-2010 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
 from browser import utils
 import os
 import getopt
+import shlex
 
 class Cmd(Command):
     
@@ -33,7 +34,7 @@
         all = False
         path = None
 
-        opts, args = getopt.getopt(options.split(), 'an')
+        opts, args = getopt.getopt(shlex.split(options), 'an')
 
         for name, _ignore_value in opts:
             

Modified: CalDAVClientLibrary/trunk/src/browser/commands/proxies.py
===================================================================
--- CalDAVClientLibrary/trunk/src/browser/commands/proxies.py	2010-04-27 20:51:51 UTC (rev 5538)
+++ CalDAVClientLibrary/trunk/src/browser/commands/proxies.py	2010-04-28 16:22:20 UTC (rev 5539)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2007-2008 Apple Inc. All rights reserved.
+# Copyright (c) 2007-2010 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
 from browser.subshell import SubShell
 from browser import commands
 import getopt
+import shlex
 
 class Cmd(Command):
     
@@ -37,7 +38,7 @@
         principal = self.shell.account.getPrincipal()
 
         try:
-            opts, args = getopt.getopt(options.split(), 'irwp:')
+            opts, args = getopt.getopt(shlex.split(options), 'irwp:')
         except getopt.GetoptError, e:
             print str(e)
             print self.usage(name)

Modified: CalDAVClientLibrary/trunk/src/browser/commands/put.py
===================================================================
--- CalDAVClientLibrary/trunk/src/browser/commands/put.py	2010-04-27 20:51:51 UTC (rev 5538)
+++ CalDAVClientLibrary/trunk/src/browser/commands/put.py	2010-04-28 16:22:20 UTC (rev 5539)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2007-2009 Apple Inc. All rights reserved.
+# Copyright (c) 2007-2010 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
 from protocol.url import URL
 import os
 import getopt
+import shlex
 
 class Cmd(Command):
     
@@ -32,7 +33,7 @@
         content_type = "text/plain"
         path = None
 
-        opts, args = getopt.getopt(options.split(), 'f:t:')
+        opts, args = getopt.getopt(shlex.split(options), 'f:t:')
 
         for name, value in opts:
             

Modified: CalDAVClientLibrary/trunk/src/browser/commands/rm.py
===================================================================
--- CalDAVClientLibrary/trunk/src/browser/commands/rm.py	2010-04-27 20:51:51 UTC (rev 5538)
+++ CalDAVClientLibrary/trunk/src/browser/commands/rm.py	2010-04-28 16:22:20 UTC (rev 5539)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2007-2008 Apple Inc. All rights reserved.
+# Copyright (c) 2007-2010 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
 import getopt
 import os
 import readline
+import shlex
 
 class Cmd(Command):
     
@@ -29,7 +30,7 @@
         
     def execute(self, name, options):
 
-        opts, args = getopt.getopt(options.split(), '')
+        opts, args = getopt.getopt(shlex.split(options), '')
 
         for name, _ignore_value in opts:
             
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100428/5dc3464b/attachment-0001.html>


More information about the calendarserver-changes mailing list