brew_bash_completion: more coverage
Add completion support for a few more built-in commands. Closes Homebrew/homebrew#40293. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
parent
2a6a0e72ac
commit
32b3fc064b
@ -101,6 +101,13 @@ __brew_complete_versions ()
|
|||||||
COMPREPLY=($(compgen -W "$versions" -X "$formula" -- "$cur"))
|
COMPREPLY=($(compgen -W "$versions" -X "$formula" -- "$cur"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__brew_complete_logs ()
|
||||||
|
{
|
||||||
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
local logs=$(ls ${HOMEBREW_LOGS:-~/Library/Logs/Homebrew/})
|
||||||
|
COMPREPLY=($(compgen -W "$logs" -- "$cur"))
|
||||||
|
}
|
||||||
|
|
||||||
_brew_switch ()
|
_brew_switch ()
|
||||||
{
|
{
|
||||||
case "$COMP_CWORD" in
|
case "$COMP_CWORD" in
|
||||||
@ -217,6 +224,18 @@ _brew_fetch ()
|
|||||||
__brew_complete_formulae
|
__brew_complete_formulae
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_brew_gist_logs ()
|
||||||
|
{
|
||||||
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__brewcomp "--new-issue"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
__brew_complete_logs
|
||||||
|
}
|
||||||
|
|
||||||
_brew_info ()
|
_brew_info ()
|
||||||
{
|
{
|
||||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
@ -257,6 +276,17 @@ _brew_install ()
|
|||||||
__brew_complete_formulae
|
__brew_complete_formulae
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_brew_irb ()
|
||||||
|
{
|
||||||
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__brewcomp "--examples"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
_brew_link ()
|
_brew_link ()
|
||||||
{
|
{
|
||||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
@ -337,6 +367,17 @@ _brew_log ()
|
|||||||
__brew_complete_formulae
|
__brew_complete_formulae
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_brew_man ()
|
||||||
|
{
|
||||||
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__brewcomp "--link --server --verbose"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
_brew_options ()
|
_brew_options ()
|
||||||
{
|
{
|
||||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
@ -360,6 +401,52 @@ _brew_outdated ()
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_brew_postinstall ()
|
||||||
|
{
|
||||||
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__brewcomp "--debug --sandbox"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
__brew_complete_installed
|
||||||
|
}
|
||||||
|
|
||||||
|
_brew_prune ()
|
||||||
|
{
|
||||||
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__brewcomp "--dry-run --verbose"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_brew_pull ()
|
||||||
|
{
|
||||||
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__brewcomp "--bottle --bump --clean --ignore-whitespace --install --resolve"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_brew_readall ()
|
||||||
|
{
|
||||||
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__brewcomp "--syntax"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
__brew_complete_tapped
|
||||||
|
}
|
||||||
|
|
||||||
_brew_search ()
|
_brew_search ()
|
||||||
{
|
{
|
||||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
@ -371,6 +458,40 @@ _brew_search ()
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_brew_style ()
|
||||||
|
{
|
||||||
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__brewcomp "--fix --homebrew-developer"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
__brew_complete_formulae
|
||||||
|
}
|
||||||
|
|
||||||
|
_brew_tap_readme ()
|
||||||
|
{
|
||||||
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__brewcomp "--verbose"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_brew_tests ()
|
||||||
|
{
|
||||||
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__brewcomp "--verbose"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
_brew_uninstall ()
|
_brew_uninstall ()
|
||||||
{
|
{
|
||||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
@ -462,7 +583,9 @@ _brew ()
|
|||||||
__brewcomp "
|
__brewcomp "
|
||||||
--cache --cellar
|
--cache --cellar
|
||||||
--env --prefix --repository
|
--env --prefix --repository
|
||||||
|
aspell-dictionaries
|
||||||
audit
|
audit
|
||||||
|
bottle
|
||||||
cat
|
cat
|
||||||
cleanup
|
cleanup
|
||||||
commands
|
commands
|
||||||
@ -473,26 +596,40 @@ _brew ()
|
|||||||
doctor
|
doctor
|
||||||
edit
|
edit
|
||||||
fetch
|
fetch
|
||||||
|
gist-logs
|
||||||
help
|
help
|
||||||
home
|
home
|
||||||
info abv
|
info abv
|
||||||
install
|
install
|
||||||
|
irb
|
||||||
|
leaves
|
||||||
linkapps
|
linkapps
|
||||||
link ln
|
link ln
|
||||||
list ls
|
list ls
|
||||||
log
|
log
|
||||||
|
man
|
||||||
missing
|
missing
|
||||||
options
|
options
|
||||||
outdated
|
outdated
|
||||||
prune
|
prune
|
||||||
pin
|
pin
|
||||||
|
postinstall
|
||||||
|
pull
|
||||||
|
readall
|
||||||
search
|
search
|
||||||
reinstall
|
reinstall
|
||||||
|
sh
|
||||||
|
style
|
||||||
|
switch
|
||||||
tap
|
tap
|
||||||
|
tap-readme
|
||||||
test
|
test
|
||||||
|
test-bot
|
||||||
|
tests
|
||||||
uninstall remove rm
|
uninstall remove rm
|
||||||
unlink
|
unlink
|
||||||
unlinkapps
|
unlinkapps
|
||||||
|
unpack
|
||||||
unpin
|
unpin
|
||||||
untap
|
untap
|
||||||
update
|
update
|
||||||
@ -514,19 +651,29 @@ _brew ()
|
|||||||
doctor|dr) _brew_doctor ;;
|
doctor|dr) _brew_doctor ;;
|
||||||
diy|configure) _brew_diy ;;
|
diy|configure) _brew_diy ;;
|
||||||
fetch) _brew_fetch ;;
|
fetch) _brew_fetch ;;
|
||||||
|
gist-logs) _brew_gist_logs ;;
|
||||||
info|abv) _brew_info ;;
|
info|abv) _brew_info ;;
|
||||||
install|instal|reinstall) _brew_install ;;
|
install|instal|reinstall) _brew_install ;;
|
||||||
|
irb) _brew_irb ;;
|
||||||
link|ln) _brew_link ;;
|
link|ln) _brew_link ;;
|
||||||
linkapps) _brew_linkapps ;;
|
linkapps) _brew_linkapps ;;
|
||||||
list|ls) _brew_list ;;
|
list|ls) _brew_list ;;
|
||||||
log) _brew_log ;;
|
log) _brew_log ;;
|
||||||
|
man) _brew_man ;;
|
||||||
missing) __brew_complete_formulae ;;
|
missing) __brew_complete_formulae ;;
|
||||||
options) _brew_options ;;
|
options) _brew_options ;;
|
||||||
outdated) _brew_outdated ;;
|
outdated) _brew_outdated ;;
|
||||||
pin) __brew_complete_formulae ;;
|
pin) __brew_complete_formulae ;;
|
||||||
|
postinstall) _brew_postinstall ;;
|
||||||
|
prune) _brew_prune ;;
|
||||||
|
pull) _brew_pull ;;
|
||||||
|
readall) _brew_readall ;;
|
||||||
search|-S) _brew_search ;;
|
search|-S) _brew_search ;;
|
||||||
|
style) _brew_style ;;
|
||||||
switch) _brew_switch ;;
|
switch) _brew_switch ;;
|
||||||
tap) _brew_complete_tap ;;
|
tap) _brew_complete_tap ;;
|
||||||
|
tap-readme) _brew_tap_readme ;;
|
||||||
|
tests) _brew_tests ;;
|
||||||
uninstall|remove|rm) _brew_uninstall ;;
|
uninstall|remove|rm) _brew_uninstall ;;
|
||||||
unpack) _brew_unpack ;;
|
unpack) _brew_unpack ;;
|
||||||
unpin) __brew_complete_formulae ;;
|
unpin) __brew_complete_formulae ;;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user