aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/completions/brew.fish
diff options
context:
space:
mode:
authorGravatar Valerii Hiora <valerii.hiora@gmail.com>2013-03-30 06:33:32 +0200
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-04-04 21:41:59 -0700
commitc05281492daae0607340ff8fba9058efefa82f24 (patch)
tree47669653cdb1c6670ffe2f9a144f5c1962d03e60 /share/completions/brew.fish
parent5cebd3abf763ea3b28e42884917f2b8af6bcc473 (diff)
Improved brew completion
Using arg completion Context-based completion for most of commands (i.e. only installed packages for upgrade or remove, only outdated for upgrade and so on)
Diffstat (limited to 'share/completions/brew.fish')
-rw-r--r--share/completions/brew.fish133
1 files changed, 71 insertions, 62 deletions
diff --git a/share/completions/brew.fish b/share/completions/brew.fish
index 003b2eca..fe1ee764 100644
--- a/share/completions/brew.fish
+++ b/share/completions/brew.fish
@@ -22,96 +22,105 @@ function __fish_brew_formulae
ls $formuladir/*.rb | sed 's/.rb$//' | sed "s|^$formuladir||"
end
+function __fish_brew_installed_formulas
+ brew list
+end
+
+function __fish_brew_outdated_formulas
+ brew outdated
+end
+
+
############
# commands #
############
# audit
complete -f -c brew -n '__fish_brew_needs_command' -a audit -d 'Check formula'
-complete -f -c brew -n '__fish_brew_using_command audit' -a '(__fish_brew_formulae)' -d 'formula'
+complete -f -c brew -n '__fish_brew_using_command audit' -a '(__fish_brew_formulae)'
# cat
complete -f -c brew -n '__fish_brew_needs_command' -a cat -d 'Display formula'
-complete -f -c brew -n '__fish_brew_using_command cat' -a '(__fish_brew_formulae)' -d 'formula'
+complete -f -c brew -n '__fish_brew_using_command cat' -a '(__fish_brew_formulae)'
# cleanup
complete -f -c brew -n '__fish_brew_needs_command' -a cleanup -d 'Remove old installed versions'
complete -f -c brew -n '__fish_brew_using_command cleanup' -l force -d 'Remove out-of-date keg-only brews as well'
-complete -f -c brew -n '__fish_brew_using_command cleanup' -a '-n' -d 'Dry run'
-complete -f -c brew -n '__fish_brew_using_command cleanup' -a '-s' -d 'Scrubs the cache'
-complete -f -c brew -n '__fish_brew_using_command cleanup' -a '(__fish_brew_formulae)' -d 'formula'
+complete -f -c brew -n '__fish_brew_using_command cleanup' -s n -d 'Dry run'
+complete -f -c brew -n '__fish_brew_using_command cleanup' -s s -d 'Scrubs the cache'
+complete -f -c brew -n '__fish_brew_using_command cleanup' -a '(__fish_brew_installed_formulas)'
# create
complete -f -c brew -n '__fish_brew_needs_command' -a create -d 'Create new formula from URL'
-complete -f -c brew -n '__fish_brew_using_command create' -a '--cmake' -d 'Use template for CMake-style build'
-complete -f -c brew -n '__fish_brew_using_command create' -a '--autotools' -d 'Use template for Autotools-style build'
-complete -f -c brew -n '__fish_brew_using_command create' -a '--no-fetch' -d 'Don\'t download URL'
+complete -f -c brew -n '__fish_brew_using_command create' -l cmake -d 'Use template for CMake-style build'
+complete -f -c brew -n '__fish_brew_using_command create' -l autotools -d 'Use template for Autotools-style build'
+complete -f -c brew -n '__fish_brew_using_command create' -l no-fetch -d 'Don\'t download URL'
# deps
complete -f -c brew -n '__fish_brew_needs_command' -a deps -d 'Show a formula\'s dependencies'
-complete -f -c brew -n '__fish_brew_using_command deps' -a '--1' -d 'Show only 1 level down'
-complete -f -c brew -n '__fish_brew_using_command deps' -a '-n' -d 'Show in topological order'
-complete -f -c brew -n '__fish_brew_using_command deps' -a '--tree' -d 'Show dependencies as tree'
-complete -f -c brew -n '__fish_brew_using_command deps' -a '--all' -d 'Show dependencies for all formulae'
-complete -f -c brew -n '__fish_brew_using_command deps' -a '(__fish_brew_formulae)' -d 'formula'
+complete -f -c brew -n '__fish_brew_using_command deps' -l 1 -d 'Show only 1 level down'
+complete -f -c brew -n '__fish_brew_using_command deps' -s n -d 'Show in topological order'
+complete -f -c brew -n '__fish_brew_using_command deps' -l tree -d 'Show dependencies as tree'
+complete -f -c brew -n '__fish_brew_using_command deps' -l all -d 'Show dependencies for all formulae'
+complete -f -c brew -n '__fish_brew_using_command deps' -a '(__fish_brew_formulae)'
# diy
complete -f -c brew -n '__fish_brew_needs_command' -a 'diy configure' -d 'Determine installation prefix for non-brew software'
-complete -f -c brew -n '__fish_brew_using_command diy' -a '--set-name' -d 'Set name of package'
-complete -f -c brew -n '__fish_brew_using_command diy' -a '--set-version' -d 'Set version of package'
+complete -f -c brew -n '__fish_brew_using_command diy' -l set-name -d 'Set name of package'
+complete -f -c brew -n '__fish_brew_using_command diy' -l set-version -d 'Set version of package'
complete -f -c brew -n '__fish_brew_needs_command' -a 'doctor' -d 'Check your system for problems'
complete -f -c brew -n '__fish_brew_needs_command' -a 'edit' -d 'Open brew/formula for editing'
# fetch
complete -f -c brew -n '__fish_brew_needs_command' -a fetch -d 'Download source for formula'
-complete -f -c brew -n '__fish_brew_using_command fetch' -a '--force' -d 'Remove a previously cached version and re-fetch'
-complete -f -c brew -n '__fish_brew_using_command fetch' -a '--HEAD' -d 'Download the HEAD version from a VCS'
-complete -f -c brew -n '__fish_brew_using_command fetch' -a '--deps' -d 'Also download dependencies'
-complete -f -c brew -n '__fish_brew_using_command fetch' -a '-v' -d 'Make HEAD checkout verbose'
-complete -f -c brew -n '__fish_brew_using_command fetch' -a '(__fish_brew_formulae)' -d 'formula'
+complete -f -c brew -n '__fish_brew_using_command fetch' -l force -d 'Remove a previously cached version and re-fetch'
+complete -f -c brew -n '__fish_brew_using_command fetch' -l HEAD -d 'Download the HEAD version from a VCS'
+complete -f -c brew -n '__fish_brew_using_command fetch' -l deps -d 'Also download dependencies'
+complete -f -c brew -n '__fish_brew_using_command fetch' -s v -d 'Make HEAD checkout verbose'
+complete -f -c brew -n '__fish_brew_using_command fetch' -a '(__fish_brew_formulae)'
complete -f -c brew -n '__fish_brew_needs_command' -a 'help' -d 'Display help'
# home
complete -f -c brew -n '__fish_brew_needs_command' -a home -d 'Open brew/formula\'s homepage'
-complete -c brew -n '__fish_brew_using_command home' -a '(__fish_brew_formulae)' -d 'formula'
+complete -c brew -n '__fish_brew_using_command home' -a '(__fish_brew_formulae)'
# info
complete -f -c brew -n '__fish_brew_needs_command' -a 'info abv' -d 'Display information about formula'
-complete -f -c brew -n '__fish_brew_using_command info' -a '--all' -d 'Display info for all formulae'
-complete -f -c brew -n '__fish_brew_using_command info' -a '--github' -d 'Open the GitHub History page for formula'
-complete -c brew -n '__fish_brew_using_command info' -a '(__fish_brew_formulae)' -d 'formula'
+complete -f -c brew -n '__fish_brew_using_command info' -l all -d 'Display info for all formulae'
+complete -f -c brew -n '__fish_brew_using_command info' -l github -d 'Open the GitHub History page for formula'
+complete -c brew -n '__fish_brew_using_command info' -a '(__fish_brew_formulae)'
# install
complete -f -c brew -n '__fish_brew_needs_command' -a 'install' -d 'Install formula'
-complete -f -c brew -n '__fish_brew_using_command install' -a '--force' -d 'Force install'
-complete -f -c brew -n '__fish_brew_using_command install' -a '--debug' -d 'If install fails, open shell in temp directory'
-complete -f -c brew -n '__fish_brew_using_command install' -a '--ignore-dependencies' -d 'skip installing any dependencies of any kind'
-complete -f -c brew -n '__fish_brew_using_command install' -a '--fresh' -d 'Don\'t re-use any options from previous installs'
-complete -f -c brew -n '__fish_brew_using_command install' -a '--use-clang' -d 'Attempt to compile using clang'
-complete -f -c brew -n '__fish_brew_using_command install' -a '--use-gcc' -d 'Attempt to compile using GCC'
-complete -f -c brew -n '__fish_brew_using_command install' -a '--use-llvm' -d 'Attempt to compile using the LLVM'
-complete -f -c brew -n '__fish_brew_using_command install' -a '--build-from-source' -d 'Compile from source even if a bottle is provided'
-complete -f -c brew -n '__fish_brew_using_command install' -a '--devel' -d 'Install the development version of formula'
-complete -f -c brew -n '__fish_brew_using_command install' -a '--HEAD' -d 'Install the HEAD version from VCS'
-complete -f -c brew -n '__fish_brew_using_command install' -a '--interactive' -d 'Download and patch formula, then open a shell'
-complete -c brew -n '__fish_brew_using_command install' -a '(__fish_brew_formulae)' -d 'formula'
+complete -f -c brew -n '__fish_brew_using_command install' -l force -d 'Force install'
+complete -f -c brew -n '__fish_brew_using_command install' -l debug -d 'If install fails, open shell in temp directory'
+complete -f -c brew -n '__fish_brew_using_command install' -l ignore-dependencies -d 'skip installing any dependencies of any kind'
+complete -f -c brew -n '__fish_brew_using_command install' -l fresh -d 'Don\'t re-use any options from previous installs'
+complete -f -c brew -n '__fish_brew_using_command install' -l use-clang -d 'Attempt to compile using clang'
+complete -f -c brew -n '__fish_brew_using_command install' -l use-gcc -d 'Attempt to compile using GCC'
+complete -f -c brew -n '__fish_brew_using_command install' -l use-llvm -d 'Attempt to compile using the LLVM'
+complete -f -c brew -n '__fish_brew_using_command install' -l build-from-source -d 'Compile from source even if a bottle is provided'
+complete -f -c brew -n '__fish_brew_using_command install' -l devel -d 'Install the development version of formula'
+complete -f -c brew -n '__fish_brew_using_command install' -l HEAD -d 'Install the HEAD version from VCS'
+complete -f -c brew -n '__fish_brew_using_command install' -l interactive -d 'Download and patch formula, then open a shell'
+complete -c brew -n '__fish_brew_using_command install' -a '(__fish_brew_formulae)'
# link
complete -f -c brew -n '__fish_brew_needs_command' -a 'link ln' -d 'Symlink installed formula'
-complete -f -c brew -n '__fish_brew_using_command link' -a '(__fish_brew_formulae)' -d 'formula'
-complete -f -c brew -n '__fish_brew_using_command ln' -a '(__fish_brew_formulae)' -d 'formula'
+complete -f -c brew -n '__fish_brew_using_command link' -a '(__fish_brew_installed_formulas)'
+complete -f -c brew -n '__fish_brew_using_command ln' -a '(__fish_brew_installed_formulas)'
# list
complete -f -c brew -n '__fish_brew_needs_command' -a 'list ls' -d 'List all installed formula'
-complete -f -c brew -n '__fish_brew_using_command list' -a '--unbrewed' -d 'List all files in the Homebrew prefix not installed by brew'
-complete -f -c brew -n '__fish_brew_using_command list' -a '--versions' -d 'Show the version number'
-complete -c brew -n '__fish_brew_using_command list' -a '(__fish_brew_formulae)' -d 'formula'
+complete -f -c brew -n '__fish_brew_using_command list' -l unbrewed -d 'List all files in the Homebrew prefix not installed by brew'
+complete -f -c brew -n '__fish_brew_using_command list' -l versions -d 'Show the version number'
+complete -c brew -n '__fish_brew_using_command list' -a '(__fish_brew_formulae)'
#ls
-complete -f -c brew -n '__fish_brew_using_command ls' -a '--unbrewed' -d 'List all files in the Homebrew prefix not installed by brew'
-complete -f -c brew -n '__fish_brew_using_command ls' -a '--versions' -d 'Show the version number'
-complete -c brew -n '__fish_brew_using_command ls' -a '(__fish_brew_formulae)' -d 'formula'
+complete -f -c brew -n '__fish_brew_using_command ls' -l unbrewed -d 'List all files in the Homebrew prefix not installed by brew'
+complete -f -c brew -n '__fish_brew_using_command ls' -l versions -d 'Show the version number'
+complete -c brew -n '__fish_brew_using_command ls' -a '(__fish_brew_formulae)'
# log
complete -f -c brew -n '__fish_brew_needs_command' -a log -d 'Show log for formula'
@@ -127,17 +136,17 @@ complete -c brew -n '__fish_brew_using_command options' -a '(__fish_brew_formula
# outdated
complete -f -c brew -n '__fish_brew_needs_command' -a outdated -d 'Show formula that have updated versions'
-complete -f -c brew -n '__fish_brew_using_command outdated' -a '--quiet' -d 'Display only names'
+complete -f -c brew -n '__fish_brew_using_command outdated' -l quiet -d 'Display only names'
# prune
complete -f -c brew -n '__fish_brew_needs_command' -a prune -d 'Remove dead symlinks'
# search
complete -f -c brew -n '__fish_brew_needs_command' -a 'search -S' -d 'Search for formula by name'
-complete -f -c brew -n '__fish_brew_using_command search' -a '--macports' -d 'Search on MacPorts'
-complete -f -c brew -n '__fish_brew_using_command search' -a '--fink' -d 'Search on Fink'
-complete -f -c brew -n '__fish_brew_using_command -S' -a '--macports' -d 'Search on MacPorts'
-complete -f -c brew -n '__fish_brew_using_command -S' -a '--fink' -d 'Search on Fink'
+complete -f -c brew -n '__fish_brew_using_command search' -l macports -d 'Search on MacPorts'
+complete -f -c brew -n '__fish_brew_using_command search' -l fink -d 'Search on Fink'
+complete -f -c brew -n '__fish_brew_using_command -S' -l macports -d 'Search on MacPorts'
+complete -f -c brew -n '__fish_brew_using_command -S' -l fink -d 'Search on Fink'
# tap
complete -f -c brew -n '__fish_brew_needs_command' -a tap -d 'Tap a new formula repository on GitHub'
@@ -148,37 +157,37 @@ complete -c brew -n '__fish_brew_using_command test' -a '(__fish_brew_formulae)'
# uninstall
complete -f -c brew -n '__fish_brew_needs_command' -a 'uninstall remove rm' -d 'Uninstall formula'
-complete -c brew -n '__fish_brew_using_command uninstall' -a '(__fish_brew_formulae)' -d 'formula'
-complete -c brew -n '__fish_brew_using_command remove' -a '(__fish_brew_formulae)' -d 'formula'
-complete -c brew -n '__fish_brew_using_command rm' -a '(__fish_brew_formulae)' -d 'formula'
-complete -f -c brew -n '__fish_brew_using_command uninstall' -a '--force' -d 'Delete all installed versions'
-complete -f -c brew -n '__fish_brew_using_command remove' -a '--force' -d 'Delete all installed versions'
-complete -f -c brew -n '__fish_brew_using_command rm' -a '--force' -d 'Delete all installed versions'
+complete -f -c brew -n '__fish_brew_using_command uninstall' -a '(__fish_brew_installed_formulas)'
+complete -f -c brew -n '__fish_brew_using_command remove' -a '(__fish_brew_installed_formulas)'
+complete -f -c brew -n '__fish_brew_using_command rm' -a '(__fish_brew_installed_formulas)'
+complete -f -c brew -n '__fish_brew_using_command uninstall' -l force -d 'Delete all installed versions'
+complete -f -c brew -n '__fish_brew_using_command remove' -l force -d 'Delete all installed versions'
+complete -f -c brew -n '__fish_brew_using_command rm' -l force -d 'Delete all installed versions'
# unlink
complete -f -c brew -n '__fish_brew_needs_command' -a unlink -d 'Unlink formula'
-complete -c brew -n '__fish_brew_using_command unlink' -a '(__fish_brew_formulae)' -d 'formula'
+complete -c brew -n '__fish_brew_using_command unlink' -a '(__fish_brew_installed_formulas)'
# untap
complete -f -c brew -n '__fish_brew_needs_command' -a untap -d 'Remove a tapped repository'
# update
complete -f -c brew -n '__fish_brew_needs_command' -a update -d 'Fetch newest version of Homebrew and formulas'
-complete -f -c brew -n '__fish_brew_using_command update' -a '--rebase' -d 'Use git pull --rebase'
+complete -f -c brew -n '__fish_brew_using_command update' -l rebase -d 'Use git pull --rebase'
# upgrade
complete -f -c brew -n '__fish_brew_needs_command' -a upgrade -d 'Upgrade outdated brews'
-complete -c brew -n '__fish_brew_using_command upgrade' -a '(__fish_brew_formulae)' -d 'formula'
+complete -f -c brew -n '__fish_brew_using_command upgrade' -a '(__fish_brew_outdated_formulas)'
# uses
complete -f -c brew -n '__fish_brew_needs_command' -a uses -d 'Show formulas that depend on specified formula'
-complete -f -c brew -n '__fish_brew_using_command uses' -a '--installed' -d 'List only installed formulae'
-complete -c brew -n '__fish_brew_using_command uses' -a '(__fish_brew_formulae)' -d 'formula'
+complete -f -c brew -n '__fish_brew_using_command uses' -l installed -d 'List only installed formulae'
+complete -c brew -n '__fish_brew_using_command uses' -a '(__fish_brew_formulae)'
# versions
complete -f -c brew -n '__fish_brew_needs_command' -a versions -d 'List previous versions of formula'
-complete -f -c brew -n '__fish_brew_using_command versions' -a '--compact' -d 'Show all options on a single line'
-complete -c brew -n '__fish_brew_using_command versions' -a '(__fish_brew_formulae)' -d 'formula'
+complete -f -c brew -n '__fish_brew_using_command versions' -l compact -d 'Show all options on a single line'
+complete -c brew -n '__fish_brew_using_command versions' -a '(__fish_brew_formulae)'
############