Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update brew cask bash completions #3675

Merged
merged 1 commit into from
Jan 13, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 59 additions & 5 deletions completions/bash/brew
Original file line number Diff line number Diff line change
Expand Up @@ -638,17 +638,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
}

Expand All @@ -664,6 +700,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_installed
}

_brew_cask ()
{
local i=1 cmd
Expand All @@ -689,24 +737,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
Expand Down