]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blobdiff - src/allmydata/scripts/cli.py
CLI: make the --mutable-type option value for 'tahoe put' and 'tahoe mkdir' case...
[tahoe-lafs/tahoe-lafs.git] / src / allmydata / scripts / cli.py
index b041b581f4cd0f3d1109b6344fc8480822dcd92e..970c8c409e80491261f94389f487daf05b98feff 100644 (file)
@@ -51,14 +51,17 @@ class VDriveOptions(BaseOptions):
 
 class MakeDirectoryOptions(VDriveOptions):
     optParameters = [
-        ("mutable-type", None, False, "Create a mutable file in the given format. Valid formats are 'sdmf' for SDMF and 'mdmf' for MDMF"),
+        ("mutable-type", None, None, "Create a mutable directory in the given format. "
+                                     "Valid formats are SDMF and MDMF, case-insensitive."),
         ]
 
     def parseArgs(self, where=""):
         self.where = argv_to_unicode(where)
 
-        if self['mutable-type'] and self['mutable-type'] not in ("sdmf", "mdmf"):
-            raise usage.UsageError("%s is an invalid format" % self['mutable-type'])
+        if self['mutable-type']:
+            if self['mutable-type'].lower() not in ("sdmf", "mdmf"):
+                raise usage.UsageError("%s is an invalid format" % self['mutable-type'])
+            self['mutable-type'] = self['mutable-type'].lower()
 
     def getSynopsis(self):
         return "Usage:  %s mkdir [options] [REMOTE_DIR]" % (self.command_name,)
@@ -172,7 +175,8 @@ class PutOptions(VDriveOptions):
         ("mutable", "m", "Create a mutable file instead of an immutable one."),
         ]
     optParameters = [
-        ("mutable-type", None, False, "Create a mutable file in the given format. Valid formats are 'sdmf' for SDMF and 'mdmf' for MDMF"),
+        ("mutable-type", None, None, "Create a mutable file in the given format (implies --mutable). "
+                                     "Valid formats are SDMF and MDMF, case-insensitive."),
         ]
 
     def parseArgs(self, arg1=None, arg2=None):
@@ -190,13 +194,14 @@ class PutOptions(VDriveOptions):
         if self.from_file == u"-":
             self.from_file = None
 
-        if self['mutable-type'] and self['mutable-type'] not in ("sdmf", "mdmf"):
-            raise usage.UsageError("%s is an invalid format" % self['mutable-type'])
+        if self['mutable-type']:
+            if self['mutable-type'].lower() not in ("sdmf", "mdmf"):
+                raise usage.UsageError("%s is an invalid format" % self['mutable-type'])
+            self['mutable-type'] = self['mutable-type'].lower()
 
         if self['mutable-type']:
             self['mutable'] = True
 
-
     def getSynopsis(self):
         return "Usage:  %s put [options] LOCAL_FILE REMOTE_FILE" % (self.command_name,)