]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blobdiff - src/allmydata/scripts/cli.py
add --format= to 'tahoe put'/'mkdir', remove --mutable-type. Closes #1561
[tahoe-lafs/tahoe-lafs.git] / src / allmydata / scripts / cli.py
index 970c8c409e80491261f94389f487daf05b98feff..950f6a79dff311f6fec5055a3bb61fcbc425e417 100644 (file)
@@ -51,17 +51,15 @@ class VDriveOptions(BaseOptions):
 
 class MakeDirectoryOptions(VDriveOptions):
     optParameters = [
-        ("mutable-type", None, None, "Create a mutable directory in the given format. "
-                                     "Valid formats are SDMF and MDMF, case-insensitive."),
+        ("format", None, None, "Create directory with the given format: SDMF and MDMF for mutable. (case-insensitive)"),
         ]
 
     def parseArgs(self, where=""):
         self.where = argv_to_unicode(where)
 
-        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['format']:
+            if self['format'].upper() not in ("SDMF", "MDMF", "CHK"):
+                raise usage.UsageError("%s is an invalid format" % self['format'])
 
     def getSynopsis(self):
         return "Usage:  %s mkdir [options] [REMOTE_DIR]" % (self.command_name,)
@@ -172,11 +170,10 @@ Examples:
 
 class PutOptions(VDriveOptions):
     optFlags = [
-        ("mutable", "m", "Create a mutable file instead of an immutable one."),
+        ("mutable", "m", "Create a mutable file instead of an immutable one. (DEPRECATED, use --format=SDMF)"),
         ]
     optParameters = [
-        ("mutable-type", None, None, "Create a mutable file in the given format (implies --mutable). "
-                                     "Valid formats are SDMF and MDMF, case-insensitive."),
+        ("format", None, None, "Create file with the given format: SDMF and MDMF for mutable, CHK (default) for immutable. (case-insensitive)"),
         ]
 
     def parseArgs(self, arg1=None, arg2=None):
@@ -194,13 +191,9 @@ class PutOptions(VDriveOptions):
         if self.from_file == u"-":
             self.from_file = None
 
-        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
+        if self['format']:
+            if self['format'].upper() not in ("SDMF", "MDMF", "CHK"):
+                raise usage.UsageError("%s is an invalid format" % self['format'])
 
     def getSynopsis(self):
         return "Usage:  %s put [options] LOCAL_FILE REMOTE_FILE" % (self.command_name,)