-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
brew alias automatically re-symlinks missing aliases #58
Conversation
Allows aliases saved from a backup of `BASE_DIR` to be rewritten and symlinked into Homebrew install.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, thanks for the PR! Wondering if it might be worth doing this automatically on all/any other commands instead/as well? Could you try to benchmark with hyperfine
?
Thanks. It might be useful to just bake this in automatically to the standard I haven't done any benchmark with hyperfine before, but it seems pretty straightforward. The command will likely scale with the number of file-defined aliases. The slowest part of my script was just setting up 50 test aliases, which is slower than you'd expect. #!/bin/bash
# setup test aliases, removing bin
for i in {1..50}
do
NAME="test$i"
brew alias "$NAME=info"
rm -f "$HOMEBREW_PREFIX/bin/brew-$NAME"
done
# measure repair
hyperfine "brew alias --repair"
function finish {
# cleanup
for i in {1..50}
do
NAME="test$i"
brew unalias "$NAME"
done
}
trap finish EXIT Results are pretty typical:
|
Would that operation not fail (or at least fail to produce the expected output) without running |
Not exactly, which is the confusing part. Example problem:
|
I feel like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeh, this makes a lot more sense to me, thanks @kabel!
Allows aliases saved from a backup of
BASE_DIR
to be rewritten and symlinked into Homebrew install.