zyedidia / eget

Easily install prebuilt binaries from GitHub.
MIT License
954 stars 39 forks source link

Feature Request: allow outputting to STDOUT so `eget` becomes a pipeable tool #23

Closed nestor-custodio closed 2 years ago

nestor-custodio commented 2 years ago

Would be great if eget could stream the downloaded (in the case of --download-only) or extracted file to STDOUT somehow. This could happen either via a --stdout flag or by allowing --to to take "/dev/stdout" (which currently fails).

e.g. I want to install hostctl, but it is only available (for my system) as a ".deb" file. Currently, I can mktemp to get a safe temp file, download the file to the temp filename (using --to), run it through dpkg, then delete the temp ".deb" file. If eget could just stream the downloaded/extracted file to STDOUT, I could simply:

eget guumaster/hostctl --stdout | sudo dpkg --install /dev/stdin

... with no need for prior prep or cleanup after.


(This also seems like a more extensible solution that adding apt/deb/yum/etc install options, as I've seen suggested elsewhere, FWIW.)

zyedidia commented 2 years ago

It seems like --to /dev/stdout works except that eget also may print some other information that would break things. You can use the --quiet (-q) option to prevent this. I'll also make a commit that causes eget to write to stderr instead of stdout for messages so that the piping will still work even when you have to make a manual selection.

nestor-custodio commented 2 years ago

Ah! I'd tried --to /dev/stdout but got an error and didn't realize it was due to the additional output. I thought to try --to /dev/stdout --quiet but guess I never actually pulled the trigger on that.

Appreciate the confirmation and (as always) the fast response!