wormhole receive-file: add --overwrite
This commit is contained in:
parent
717bfa3b0b
commit
883cacf903
|
@ -65,7 +65,7 @@ def receive_file(args):
|
|||
record_pipe.send_record("bad filename\n")
|
||||
record_pipe.close()
|
||||
return 1
|
||||
if os.path.exists(target):
|
||||
if os.path.exists(target) and not args.overwrite:
|
||||
print("Error: refusing to overwrite existing file %s" % (filename,))
|
||||
record_pipe.send_record("file already exists\n")
|
||||
record_pipe.close()
|
||||
|
|
|
@ -52,6 +52,12 @@ p.add_argument("-o", "--output-file", default=None, metavar="FILENAME",
|
|||
The file to create, overriding the filename suggested by the
|
||||
sender"""),
|
||||
)
|
||||
p.add_argument("--overwrite", action="store_true",
|
||||
help=dedent("""\
|
||||
Allow the output file to be overwritten. By default, if the
|
||||
output file already exists, the program will refuse to
|
||||
overwrite it."""),
|
||||
)
|
||||
p.add_argument("code", nargs="?", default=None, metavar="[CODE]",
|
||||
help=dedent("""\
|
||||
The magic-wormhole code, from the sender. If omitted, the
|
||||
|
|
Loading…
Reference in New Issue
Block a user