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,)
("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):
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,)
fn1 = os.path.join(self.basedir, "data")
fileutil.write(fn1, data)
d = self.do_cli("create-alias", "tahoe")
- d.addCallback(lambda ignored:
- self.do_cli("put", "--mutable", "--mutable-type=mdmf",
- fn1, "tahoe:uploaded.txt"))
- d.addCallback(lambda ignored:
- self.do_cli("ls", "--json", "tahoe:uploaded.txt"))
+
+ def _put_and_ls(ign, mutable_type, filename):
+ d2 = self.do_cli("put", "--mutable", "--mutable-type="+mutable_type,
+ fn1, filename)
+ d2.addCallback(lambda ign: self.do_cli("ls", "--json", filename))
+ return d2
+
+ d.addCallback(_put_and_ls, "mdmf", "tahoe:uploaded.txt")
d.addCallback(self._check_mdmf_json)
- d.addCallback(lambda ignored:
- self.do_cli("put", "--mutable", "--mutable-type=sdmf",
- fn1, "tahoe:uploaded2.txt"))
- d.addCallback(lambda ignored:
- self.do_cli("ls", "--json", "tahoe:uploaded2.txt"))
+ d.addCallback(_put_and_ls, "MDMF", "tahoe:uploaded2.txt")
+ d.addCallback(self._check_mdmf_json)
+ d.addCallback(_put_and_ls, "sdmf", "tahoe:uploaded3.txt")
+ d.addCallback(self._check_sdmf_json)
+ d.addCallback(_put_and_ls, "SDMF", "tahoe:uploaded4.txt")
d.addCallback(self._check_sdmf_json)
return d
self.do_cli("ls", "--json", self._filecap))
d.addCallback(_check, '"mutable-type": "sdmf"')
d.addCallback(lambda ignored:
- self.do_cli("mkdir", "--mutable-type=mdmf", "tahoe:bar"))
+ self.do_cli("mkdir", "--mutable-type=MDMF", "tahoe:bar"))
d.addCallback(_check, "URI:DIR2-MDMF")
d.addCallback(_stash_dircap)
d.addCallback(lambda ignored: