Some people alias 'ls' so escape it in bash completion

This commit is contained in:
Adam Vandenberg 2010-10-01 07:07:46 -07:00
parent 20e2844df7
commit 8b8bf79315

View File

@ -12,7 +12,7 @@ _brew_to_completion()
local actions="--cache --config --prefix cat cleanup configure create local actions="--cache --config --prefix cat cleanup configure create
deps doctor edit home info install link list log outdated prune deps doctor edit home info install link list log outdated prune
remove search unlink update uses" remove search unlink update uses"
local ext=$(ls $(brew --repository)/Library/Contributions/examples | local ext=$(\ls $(brew --repository)/Library/Contributions/examples |
sed -e "s/\.rb//g" -e "s/brew-//g") sed -e "s/\.rb//g" -e "s/brew-//g")
COMPREPLY=( $(compgen -W "${actions} ${ext}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${actions} ${ext}" -- ${cur}) )
return return
@ -29,14 +29,14 @@ _brew_to_completion()
case "$prev" in case "$prev" in
# Commands that take a formula # Commands that take a formula
cat|deps|edit|fetch|home|homepage|info|install|log|options|uses) cat|deps|edit|fetch|home|homepage|info|install|log|options|uses)
local ff=$(ls $(brew --repository)/Library/Formula | sed "s/\.rb//g") local ff=$(\ls $(brew --repository)/Library/Formula | sed "s/\.rb//g")
local af=$(ls $(brew --repository)/Library/Aliases 2> /dev/null | sed "s/\.rb//g") local af=$(\ls $(brew --repository)/Library/Aliases 2> /dev/null | sed "s/\.rb//g")
COMPREPLY=( $(compgen -W "${ff} ${af}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${ff} ${af}" -- ${cur}) )
return return
;; ;;
# Commands that take an existing brew # Commands that take an existing brew
abv|cleanup|link|list|ln|ls|remove|rm|uninstall|unlink) abv|cleanup|link|list|ln|ls|remove|rm|uninstall|unlink)
COMPREPLY=( $(compgen -W "$(ls $(brew --cellar))" -- ${cur}) ) COMPREPLY=( $(compgen -W "$(\ls $(brew --cellar))" -- ${cur}) )
return return
;; ;;
esac esac