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

Support binaries in addition to functions #24

Closed
vemv opened this issue Feb 5, 2021 · 4 comments
Closed

Support binaries in addition to functions #24

vemv opened this issue Feb 5, 2021 · 4 comments

Comments

@vemv
Copy link

vemv commented Feb 5, 2021

Hi!

I'm interested in using this project. However I'm a zsh user. I noticed #16 .

Indeed it seems a hassle to port scripts, so I thought - why not make bc::cache additionally accept filenames denoting a script when func is not a function?

I think that would be it - would you be willing to give it a shot?

Would gladly provide feedback afterwards.

Thanks - V

@dimo414
Copy link
Owner

dimo414 commented Feb 5, 2021

Note that you can define trivial functions that delegate to commands and cache that, via the command builtin:

ls() { command ls "$@"; } && bc::cache ls 1m 10s PWD

This is what I would generally recommend.

Supporting arbitrary binaries is tricky because they can be referenced multiple ways; e.g. /path/to/foo, ./foo (if in /path/to), and foo (if PATH is configured properly) may all refer to the same binary. Not impossible to address but it's the sort of problem that may be easier to pass off to the user.

I'd love to support zsh (though we'd have to do #11 if we did so 😄), but I have no plans to drive that at the moment. I'd be happy to work with someone interested in contributing support though.

@dimo414 dimo414 changed the title Support filenames instead of function names Support binaries in addition to functions Feb 5, 2021
@vemv
Copy link
Author

vemv commented Mar 11, 2021

Thanks for the response!

Had forgotten about this one, sorry.

I hacked some lightweight form of caching without delegating it to a library. It seemed enough for my needs.

@vemv vemv closed this as completed Mar 11, 2021
@dimo414
Copy link
Owner

dimo414 commented Oct 7, 2021

As an update here, I'm in the process of publishing bkt, a standalone binary that's spiritually similar to bash-cache but intended for subprocesses instead of shell functions. If you'd like to try it out I'd welcome any feedback.

@vemv
Copy link
Author

vemv commented Oct 8, 2021

Cheers! Starred

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