Since brew mirgate Formula into Taps diectory
Change the way to find out all Homebrew-Core Formula
Compatible with old version Homebrew
Fix brew completion for `brew install`
Let's try to use the string builtin here instead of sed
Replace `sed` with built-in `string replace`
Modify Regex pattern to be more precise
Might it assume less and be more future-proof (and able to generalize to other Taps) if you get the Formula directory via: brew --repository homebrew/homebrew-core?
brew --repository homebrew/homebrew-core
replace fixed path to search formula with `brew --repository`
This is pretty broken in master right now, I'm merging the fix.
Wait, this is wrong:
set -l formuladir (brew --repository)/Library/Formula/ (brew --repository homebrew/core)
Using `brew search` rather than `brew --repository`
brew --repository homebrew/core is working fine.
But now I just use brew search to list all local formula, however it has some problem when tap-pin is used.
brew --repository homebrew/core
Something like this will get a working path for the main keg.
> echo (brew --repository homebrew/homebrew-core)/Formula
Compared to what I was getting from the PR update:
> echo (brew --repository)/Library/Formula/ (brew --repository homebrew/core)
> ls /usr/local/Library/Formula/
ls: /usr/local/Library/Formula/: No such file or directory
Oh, I see, probably that's fine and for compatibility with other installs, not necessarily a problem.
/usr/local/Library/Formula/ for compatible
find will search recursively because some custom tap won't have Formula directory.
Dont specify Formula for try to modify easily to search all formula from Taps.
But it seems useless, while using brew search instead
I will try this soon. How is the speed of brew search?
brew search seem a little slower than find & string replace using Macbook Air 2014.
But I think brew search will be the better choice for this purpose because it's portable.
That's much better than I'm getting. Maybe something is wrong with my install.
floam@MacBook-Pro ~> brew search x > /dev/null
floam@MacBook-Pro ~> echo $CMD_DURATION
edit: it's because I had a query. Seems fine to me.
I like it, and you can just use brew search directly now instead of wrapping it in that function.
With fresh install Hackintosh (Yosemite) last week.
$ find . -name "*.rb" -type f 2> /dev/null | string replace -r '^/(?:[^/]*/)*([^/]*)\.rb' '$1' 1> /dev/null
$ echo $CMD_DURATION
$ brew search 1> /dev/null
$ echo $CMD_DURATION
Let me know when you're done and happy and I'll merge this to master.
For brew install I think it is done.
You could merge it when anytime you want.
I will work on for other issues (e.g. tap-pin) and create another PR for fix
Thanks a lot. :)