aboutsummaryrefslogtreecommitdiffstats
path: root/completions/bash/brew
diff options
context:
space:
mode:
Diffstat (limited to 'completions/bash/brew')
-rw-r--r--completions/bash/brew77
1 files changed, 69 insertions, 8 deletions
diff --git a/completions/bash/brew b/completions/bash/brew
index 3bde8f926..02c862bbd 100644
--- a/completions/bash/brew
+++ b/completions/bash/brew
@@ -51,7 +51,7 @@ __brewcomp() {
__brew_complete_formulae() {
local cur="${COMP_WORDS[COMP_CWORD]}"
local formulas="$(brew search)"
- local shortnames="$(echo "$formulas" | grep / | cut -d / -f 3)"
+ local shortnames="$(echo "$formulas" | \grep / | \cut -d / -f 3)"
COMPREPLY=($(compgen -W "$formulas $shortnames" -- "$cur"))
}
@@ -593,7 +593,7 @@ __brew_cask_complete_formulae ()
local lib=$(brew --repository)/Library
local taps=${lib}/Taps
local casks=${lib}/Taps/caskroom/homebrew-cask/Casks
- local ff=$(\ls ${casks} 2>/dev/null | sed 's/\.rb//g')
+ local ff=$(\ls ${casks} 2>/dev/null | \sed 's/\.rb//g')
COMPREPLY=($(compgen -W "$ff" -- "$cur"))
}
@@ -613,6 +613,13 @@ __brew_cask_complete_caskroom ()
COMPREPLY=($(compgen -W "$files" -- "$cur"))
}
+__brew_cask_complete_outdated ()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ local outdated=$(brew cask outdated --quiet)
+ COMPREPLY=($(compgen -W "$outdated" -- "$cur"))
+}
+
_brew_cask_cleanup ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
@@ -638,17 +645,53 @@ _brew_cask_fetch ()
__brew_cask_complete_formulae
}
+_brew_cask_install ()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ local prv=$(__brew_caskcomp_prev)
+ case "$cur" in
+ -*)
+ __brew_caskcomp "--force --skip-cask-deps --require-sha --language"
+ return
+ ;;
+ esac
+ __brew_cask_complete_formulae
+}
+
_brew_cask_list ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
+ case "$cur" in
+ -*)
+ __brew_caskcomp "-1 --versions"
+ return
+ ;;
+ esac
+ __brew_cask_complete_installed
+}
+
+_brew_cask_outdated ()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
-*)
- __brew_caskcomp "-1 -l --versions"
+ __brew_caskcomp "--greedy --verbose --quiet"
return
;;
esac
+ __brew_cask_complete_installed
+}
+_brew_cask_style ()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ case "$cur" in
+ -*)
+ __brew_caskcomp "--fix"
+ return
+ ;;
+ esac
__brew_cask_complete_installed
}
@@ -664,6 +707,18 @@ _brew_cask_uninstall ()
__brew_cask_complete_installed
}
+_brew_cask_upgrade ()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ case "$cur" in
+ -*)
+ __brew_caskcomp "--force --greedy"
+ return
+ ;;
+ esac
+ __brew_cask_complete_outdated
+}
+
_brew_cask ()
{
local i=1 cmd
@@ -689,24 +744,30 @@ _brew_cask ()
done
if [[ $i -eq $COMP_CWORD ]]; then
- __brew_caskcomp "abv audit cat cleanup create doctor edit fetch home info install list ls remove rm search uninstall zap -S --force --caskroom --verbose --appdir --colorpickerdir --prefpanedir --qlplugindir --fontdir --servicedir --input_methoddir --internet_plugindir --screen_saverdir --no-binaries --binarydir --debug"
+ __brew_caskcomp "abv audit cat cleanup create doctor edit fetch home info install list ls outdated reinstall remove rm search style uninstall upgrade zap -S --force --caskroom --verbose --appdir --colorpickerdir --prefpanedir --qlplugindir --fontdir --servicedir --input_methoddir --internet_plugindir --screen_saverdir --no-binaries --debug --version"
return
fi
# subcommands have their own completion functions
case "$cmd" in
+ --version) __brewcomp_null ;;
audit) __brew_cask_complete_formulae ;;
cat) __brew_cask_complete_formulae ;;
cleanup) _brew_cask_cleanup ;;
- doctor) ;;
+ create) ;;
+ doctor) __brewcomp_null ;;
edit) __brew_cask_complete_formulae ;;
fetch) _brew_cask_fetch ;;
home) __brew_cask_complete_formulae ;;
info|abv) __brew_cask_complete_formulae ;;
- install|instal) __brew_cask_complete_formulae ;;
+ install|instal) _brew_cask_install ;;
list|ls) _brew_cask_list ;;
- search) ;;
+ outdated) _brew_cask_outdated ;;
+ reinstall) __brew_cask_complete_installed ;;
+ search) __brewcomp_null ;;
+ style) _brew_cask_style ;;
uninstall|remove|rm) _brew_cask_uninstall ;;
+ upgrade) _brew_cask_upgrade ;;
zap) __brew_cask_complete_caskroom ;;
*) ;;
esac
@@ -738,7 +799,7 @@ _brew() {
then
# Do not auto-complete "*instal" or "*uninstal" aliases for "*install" commands.
# Prefix newline to prevent not checking the first command.
- local cmds=$'\n'"$(brew commands --quiet --include-aliases | grep -v instal$)"
+ local cmds=$'\n'"$(brew commands --quiet --include-aliases | \grep -v instal$)"
__brewcomp "${cmds}"
return
fi