The script was lacking structure and had grown a number of one-off hacks
that would be better as reusable functions. So,
- give each subcommand that has completions it's own function
- move completion of formulae, installed brews, and outdated brews into
reusable functions
- introduce a general __brewcomp() function that takes a string of tab,
space, and/or newline separated items and converts all seperators to
newlines, and then generates a reply with compgen().
These changes should allow for easier addition of new features in the
future.
As a bonus, completion for `brew log` will include git-log options if
the git completion script is also loaded.
_brew_to_completion() is kept around for compatiblity.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>