zyedidia / eget

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

Abort when reading EOF at "enter selection number" prompt #58

Closed larsks closed 1 year ago

larsks commented 1 year ago

I'd like to run eget non-interactively in a script, but if I fail to fully specify something (or have a typo), eget will prompt interactively to select a package:

$ eget ogham/exa
2 matches found: please select manually
(1) exa-linux-x86_64-musl-v0.10.1.zip
(2) exa-linux-x86_64-v0.10.1.zip
Enter selection number:

I'd like to avoid this interactive prompt and have eget simply exit with an error if it can't select a single asset for download. I hoped this would work:

$ eget ogham/exa < /dev/null

But that results in:

Enter selection number: Invalid selection: EOF
Enter selection number: Invalid selection: EOF
Enter selection number: Invalid selection: EOF
Enter selection number: Invalid selection: EOF
[...ad infinitum...]

I think eget should simply abort if it receives an EOF at this prompt.