brew --compact

This commit is contained in:
Adam Vandenberg 2011-02-04 16:52:46 -08:00
parent 97b8f9a31f
commit 6864140237
2 changed files with 12 additions and 6 deletions

View File

@ -42,7 +42,7 @@ _brew_to_completion()
# Complete --options for selected brew
*)
[[ ${COMP_WORDS[1]} == "install" ]] && [[ "$cur" == --* ]] && {
COMPREPLY=( $(compgen -W "$(brew options "$prev" | grep -P "^--")" -- ${cur}) )
COMPREPLY=( $(compgen -W "$(brew options --compact "$prev")" -- ${cur}) )
return
}
;;

View File

@ -1,9 +1,15 @@
compact = ARGV.include? '--compact'
ARGV.formulae.each do |f|
f.options rescue next
puts f.name
f.options.each do |o|
puts o[0]
puts "\t"+o[1]
if compact
puts f.options.collect {|o| o[0]} * " "
else
puts f.name
f.options.each do |o|
puts o[0]
puts "\t"+o[1]
end
puts
end
puts
end