magic-wormhole / magic-wormhole.rs

Rust implementation of Magic Wormhole, with new features and enhancements
European Union Public License 1.2
730 stars 79 forks source link

No way to get the name/path of the received file when using --noconfirm/--yes #252

Open virinci opened 1 month ago

virinci commented 1 month ago

It would be useful in scripts to get the received file name/path for doing further operations on it. Info log such as [INFO ] Connected to rendezvous server. is printed on stderr so the received file path can be printed on the stdout.

felinira commented 1 month ago

Interesting idea. I think it would be worth it to have a --output-format command line flag to be able to have a more machine readable and stable output format like json. It could for example also return the wormhole code in a similar fashion, for use in further processing.

We should switch from log to tracing anyways, and this would allow us to use things like https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/format/struct.Json.html

Events should go on stderr. Then we can still reserve the use of stdout for eg. piping a received file into a different command, or directly connecting network sockets etc. should we ever want to do this sort of thing.

See #253 for details on how to continue with the migration to tracing. Contributions welcome.