From: Daira Hopwood Date: Tue, 28 Oct 2014 18:27:10 +0000 (+0000) Subject: Fix and simplify argument handling for put/get (it was wrong for 'tahoe put - REMOTE'). X-Git-Url: https://git.rkrishnan.org/status?a=commitdiff_plain;h=c31746af55af2680b6be3d082b8ebd66826c6377;p=tahoe-lafs%2Ftahoe-lafs.git Fix and simplify argument handling for put/get (it was wrong for 'tahoe put - REMOTE'). Signed-off-by: Daira Hopwood --- diff --git a/src/allmydata/scripts/cli.py b/src/allmydata/scripts/cli.py index b7377ead..e240c9ec 100644 --- a/src/allmydata/scripts/cli.py +++ b/src/allmydata/scripts/cli.py @@ -140,12 +140,11 @@ class GetOptions(FilesystemOptions): # tahoe get FOO bar # write to local file # tahoe get tahoe:FOO bar # same - self.from_file = argv_to_unicode(arg1) + if arg2 == "-": + arg2 = None - if arg2 and arg2 != "-": - self.to_file = argv_to_abspath(arg2) - else: - self.to_file = None + self.from_file = argv_to_unicode(arg1) + self.to_file = None if arg2 is None else argv_to_abspath(arg2) def getSynopsis(self): return "Usage: %s [global-opts] get [options] REMOTE_FILE LOCAL_FILE" % (self.command_name,) @@ -180,15 +179,8 @@ class PutOptions(FilesystemOptions): if arg1 == "-": arg1 = None - if arg1 is not None and arg2 is not None: - self.from_file = argv_to_abspath(arg1) - self.to_file = argv_to_unicode(arg2) - elif arg1 is not None and arg2 is None: - self.from_file = argv_to_abspath(arg1) - self.to_file = None - else: - self.from_file = None - self.to_file = None + self.from_file = None if arg1 is None else argv_to_abspath(arg1) + self.to_file = None if arg2 is None else argv_to_unicode(arg2) if self['format']: if self['format'].upper() not in ("SDMF", "MDMF", "CHK"):