diff options
| -rw-r--r-- | completions/bash/brew | 70 | ||||
| -rw-r--r-- | completions/zsh/_brew | 4 | ||||
| -rw-r--r-- | completions/zsh/_brew_cask | 8 | 
3 files changed, 70 insertions, 12 deletions
| diff --git a/completions/bash/brew b/completions/bash/brew index 3bde8f926..f885b808d 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"))  } @@ -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  } @@ -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 @@ -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 @@ -738,7 +792,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 diff --git a/completions/zsh/_brew b/completions/zsh/_brew index 22792860d..e4f874bfb 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -711,7 +711,7 @@ _brew_uninstall() {  # brew unlink [--dry-run] formula:  _brew_unlink() {    _arguments \ -    '(--dry-run =n)'{--dry-run,=n}'[don''t unlink or delete any files]' \ +    '(--dry-run -n)'{--dry-run,-n}'[don''t unlink or delete any files]' \      ':formula:__brew_installed_formulae'  } @@ -719,7 +719,7 @@ _brew_unlink() {  _brew_unlinkapps() {    _arguments \      '(--local)--local[remove symlinks from ~/Applications instead of the system directory]' \ -    '(--dry-run =n)'{--dry-run,-n}'[don''t unlink or delete any files]' \ +    '(--dry-run -n)'{--dry-run,-n}'[don''t unlink or delete any files]' \      ':formula:__brew_installed_formulae'  } diff --git a/completions/zsh/_brew_cask b/completions/zsh/_brew_cask index ff277ea60..d702ea093 100644 --- a/completions/zsh/_brew_cask +++ b/completions/zsh/_brew_cask @@ -12,17 +12,21 @@  zstyle -T ':completion:*:*:*:brew-cask:*' tag-order && \  	zstyle ':completion:*:*:*:brew-cask:*' tag-order 'commands' +__brew_cask() { +  [ -d "$(brew --repo caskroom/cask)" ] && brew cask $@ +} +  __brew_all_casks() {    local -a list    local expl -  list=( $(brew cask search) ) +  list=( $(__brew_cask search) )    _wanted list expl 'all casks' compadd -a list  }  __brew_installed_casks() {    local -a list    local expl -  list=( $(brew cask list|sed 's/(!)//') ) +  list=( $(__brew_cask list|sed 's/(!)//') )    _wanted list expl 'installed casks' compadd -a list  } | 
