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 zsh and other shells #16

Open
dimo414 opened this issue May 25, 2019 · 3 comments
Open

Support zsh and other shells #16

dimo414 opened this issue May 25, 2019 · 3 comments
Labels
enhancement New feature or request minor

Comments

@dimo414
Copy link
Owner

dimo414 commented May 25, 2019

Original report by Michael Diamond (Bitbucket: dimo414).


@bedge asked for zsh support in #15. Supporting other shells would be nice, but would require user contributions as it's not a priority for me personally. If anyone's interested in contributing feel free to reach out here.

@KTSCode
Copy link

KTSCode commented Aug 5, 2021

Just switched to zsh from bash because I'm using MacOS and didn't want to keep using an outdated version of bash. I'm really sad to be losing bash-cache functionality it's quite helpful in my tmux status bar scripts which hit external APIs.

What steps would be necessary to make bash-cache work for zsh?

@dimo414
Copy link
Owner Author

dimo414 commented Aug 5, 2021

FWIW it's pretty easy to get a modern bash running on macOS; with homebrew it's just brew install bash.

I really don't know how much work would be involved. As I don't use zsh I'm not sure exactly which bash-isms would need to be redesigned (or the best way to do it). But I wouldn't be surprised if it's non-trivial, since bash-cache does some distinctly power-user things. Some potential issues that stand out:

  • bc::copy_function enables the decorator pattern bash-cache uses
  • The function-template pattern isn't strictly necessary but I'd be disappointed to have to remove it
  • This descriptor juggling is important for safe reads
  • bc::locked_cache requires Bash 4.1's anonymous descriptor support

@dimo414
Copy link
Owner Author

dimo414 commented Oct 7, 2021

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. Although it fits a slightly different niche than caching shell functions it may still be useful for zsh et al. users. If you'd like to try it out I'd welcome any feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request minor
Projects
None yet
Development

No branches or pull requests

2 participants