olets / zsh-abbr

The zsh manager for auto-expanding abbreviations, inspired by fish. ~13,000 unique cloners as of May '24, 580+ Homebrew installs 6/23-6/24
https://zsh-abbr.olets.dev
Other
517 stars 18 forks source link

Remove unneeded mktemp usage and default to /tmp #3

Closed ifreund closed 4 years ago

ifreund commented 4 years ago

The current usage is incompatible with GNU mktemp, and is also unnecessary, as it does not leverage the XXXXXX mechanism to avoid conflicts.

Also, $TMPDIR is usually not set on linux distributions, in which case /tmp should be used by default.

This is, I think, a better solution than #1 as it stays much closer to the current logic.

olets commented 4 years ago

Cool this is a good solution. Thanks!

The scratch file is an approximation of a user-wide variable (still has to be sourced but that's faster than processing the human-readable .config file, especially with the 2.1.0 change to have the config file be a list of commands) so all sessions have to share a single file. mktemp ...XXX would have lost that, but this approach doesn't.

Would you add chmod 600 <the file> after the touches? Gets us pretty close to mktemp

ifreund commented 4 years ago

Good call, I've added the chown and removed the redirection to /dev/null as it's unneeded with touch.

olets commented 4 years ago

Works for me on macos. Thanks for the contribution!

You found the project at an exciting time moment, I'm aiming to get 3.0 out in the next week or two. Keep an eye out for it

olets commented 4 years ago

Released in v2.1.1

ifreund commented 4 years ago

Excellent! I see you've added some contribution guidelines as well.

olets commented 4 years ago

And the code of conduct. And no worries about the commit messages guidelines, not aimed at you just gearing up for some wider sharing

ifreund commented 4 years ago

Cool cool, I just made an AUR package for my own use by the way.