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

Create wrappers instead of symlinks #117

Open
cornfeedhobo opened this issue Sep 30, 2023 · 6 comments
Open

Create wrappers instead of symlinks #117

cornfeedhobo opened this issue Sep 30, 2023 · 6 comments

Comments

@cornfeedhobo
Copy link
Contributor

Many tools expect to be run from a specific location.

I've made PRs to fix this in downstream tools, but I think it's time to consider having basher write wrappers scripts that are little more than

cd $repo_path
exec ./bin/repo_name

This would work around scripts that don't handle linking when sourcing child scripts

@hyperupcall
Copy link
Contributor

hyperupcall commented Sep 30, 2023

At least for me, i'm not convinved this should be the default since the wrapper would incur a penalty of longer execution time (largely nullifying any tool's attempts to be snappy), but maybe there could be an environment varaible / option that enables this behavior

@juanibiapina
Copy link
Member

Do you have examples that fail?

@cornfeedhobo
Copy link
Contributor Author

@juanibiapina asdf fails. This issue was inspired by an issue I filed with them this morning, and from the previous patches I had to submit to goenv and pyenv to get them to play nicely. Unfortunately asdf does not appear to be willing to accept such a patch, and that got me thinking about other repos that might be similarly unable to be uplifted.

@hyperupcall
Copy link
Contributor

hyperupcall commented Oct 1, 2023

@cornfeedhobo I just want to be clear, I didn't accept the patch because it was an incomplete fix (things would break) - not because I was unwilling. That's not to say this wouldn't be a useful feature - just that in the case of asdf, I don't think it applies.

@juanibiapina
Copy link
Member

By looking at install instructions for asdf, it seems to me like asdf is meant to be sourced, not used as a binary. Even if we created a wrapper here, I suspect asdf wouldn't work properly, based on the information on asdf-vm/asdf#1658

A different approach could be to add support for basher to source files from certain packages. In my experience though, finding a heuristic that works for majority of packages can be quite difficult, since there's no pattern that identifies which files should be sourced.

An alternative is to just accept asdf is an important enough project that requires and deserves its own specific installation method.


A super hopeful approach would be to create a standard for bash packages where files that need to be sourced live in a specific directory, but I have no hopes of accomplishing such a feat.

@cornfeedhobo
Copy link
Contributor Author

cornfeedhobo commented Oct 5, 2023

asdf is meant to be sourced

My use of exec was off-the-cuff. In reality it should probably be sourced, given the pattern.

A super hopeful approach would be to create a standard for bash packages

I can't find the origin of this pattern, but there was an original repo that started the repo convention used by many of these "bash packages", such as rbenv, pyenv, goenv, nodenv, etc. If I can track it down, I'll be sure to comment again with a link.

Edit: https://github.com/qrush/sub

asdf is an important enough project that requires and deserves its own specific installation method.

IMHO, this convention has existed for nearly 10 years now. I don't think it's special enough; and to their credit, they have outstanding issues that would address this eventually, like adding init subcommand support, but for now that doesn't seem to be a reality, and I'm just trying to make life a tiny bit easier.

I would also like to remind everyone that asdf is only one example. As I also said, I had to submit PRs to goenv and pyenv to fix the exact same issue - the main difference being that their repos were in a mature enough state that it was easy for them to accept it.

In theory, it would have been nice to not have had to submit those PRs and things still work.

Edit: Also to be clear, this proposal would still not fix asdf until they move the initialization from a script in the root, to an init subcommand.

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

3 participants