TritonDataCenter / node-manta

Node.js SDK for Manta
75 stars 54 forks source link

Alternative behaviors for mput with multiple uses of -f #286

Open rmustacc opened 8 years ago

rmustacc commented 8 years ago

Today, if you try to specify mput with multiple invocations of the '-f' option, the last one wins. This behavior can be a little confusing. I'm not sure if we can change it, but it might be nice if we could have one of the following behaviors:

$ mput -f output/platform-20161117T180610Z.tgz -f output-usb/platform-20161117T180610Z.usb.bz2 -f output-iso/platform-20161117T180610Z.iso ~~/public/preview/xhci/20161110/smartos

Maybe clarifying the manual page to specify that the last file wins would also be sufficient.

davepacheco commented 8 years ago

IIRC, the second option is complicated because "mput -f x y" will put the file to "y" (not "y/x") if "y" does not already exist. If that's not possible, explicitly failing seems much better, and I don't think I would consider that a breaking change.

trentm commented 8 years ago

FWIW:

$ mantash put -h
put a local file to manta

Usage:
    put [OPTIONS] LOCAL-PATH MANTA-PATH
    put [OPTIONS] LOCAL-PATH ... MANTA-DIRECTORY

Would it be too subtle to have behaviour like that ^^ (i.e. more like cp) if no '-f' flag was given?

mput -f LOCAL-PATH MANTA-PATH     # 1.
mput LOCAL-PATH MANTA-PATH     # 2.
mput LOCAL-PATH ... MANTA-DIRECTORY     # 3.
...stdin... | mput MANTA-PATH    # 4.

mput -f LOCAL-PATH LOCAL-PATH MANTA-PATH   # error because -f usage and >1 arg

I don't think there is an ambiguity, just perhaps subtle.

Then there may be other Qs, like should mput LOCAL-PATH MANTA-DIRECTORY work as cp does by writing to MANTA-DIRECTORY/$(basename LOCAL-PATH).