Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

idempotent #181

Open
gedw99 opened this issue Oct 16, 2023 · 4 comments
Open

idempotent #181

gedw99 opened this issue Oct 16, 2023 · 4 comments

Comments

@gedw99
Copy link

gedw99 commented Oct 16, 2023

any thoughts on the ability to declare the bins you need on a project and then have a way for the bins to be pulled as requested.

https://github.com/aquaproj/aqua is a similar project and it has the concept of a proxy. When you make a call to a bin, it will pull it down and then let the call pass through to execute that bin. here it is: https://github.com/aquaproj/aqua-proxy

@WillAbides
Copy link
Owner

I don't think it's exactly what you're asking for, but bindown install is idempotent in that it only installs if the existing binary is missing or not the expected version. You could do something similar to the aqua proxy with bindown install foo && ./bin/foo --your args here.

I've considered adding a bindown exec command so you can simplify the above to bindown exec foo -- --your args here. I've held back from doing that because I don't like that foo would be wrapped by a second process and things like os signals from ctrl-c would need to be passed through the wrapper. This isn't to say I won't add it, rather that it needs to be almost as robust as bindown install foo && ./bin/foo.

I want bindown to remain simple, so I probably won't add anything as complex as a proxy.

As I'm writing this, I have the germ of an idea for an alternative that could be a functional alternative. A new command bindown generate-wrappers could create a shell script for each dependency that does something like bindown -q install foo && exec ./bin/foo "$@". That wouldn't be quite as slick as a proxy, but it would be a lot simpler to debug and maintain.

@gedw99
Copy link
Author

gedw99 commented Oct 25, 2023

Hey

@WillAbides

you def got the intent, and I appreciate your review and thoughts.

I concur. Shell scripts are simple and cross platform with "wiggle room" too.

@WillAbides
Copy link
Owner

I've been thinking more about "generate-wrappers", and I think I'm going to add something like that soon. Instead of a separate command, I'm thinking bindown install --wrapper jq yq whatever else. I also want to add bindown install --all that will install all dependencies. Combined you could populate bin with wrappers for all your dependencies with bindown install --wrapper --all.

@gedw99
Copy link
Author

gedw99 commented Feb 12, 2024

Hey @WillAbides

thanks for considering this “ serverless” pattern.

Then I can call a binary that is not there yet.

I guess we can trap the std out and std error etc coming out of the binary that is being invoked. Perhaps even divert it to the cli . Lots of possibilities.

This reminds me a bit of overmind which I use. It’s able to trap the TTY ( I think that’s the correct term ).

https://github.com/DarthSim/overmind

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants