fish: add homebrew functions
This commit is contained in:
parent
f2bc669b21
commit
6dd195581e
15
fish/functions/brew_installed.fish
Normal file
15
fish/functions/brew_installed.fish
Normal file
@ -0,0 +1,15 @@
|
||||
function brew_installed --description "List installed top-level formulas"
|
||||
set --local __brew_pkgs ''
|
||||
set --local __brew_deps ''
|
||||
|
||||
for __brew_pkg in (brew deps --installed)
|
||||
set __brew_pkgs $__brew_pkgs (string split ':' $__brew_pkg | head -n 1)
|
||||
set __brew_deps $__brew_deps (string split ' ' (string split ':' $__brew_pkg | tail -n +2))
|
||||
end
|
||||
|
||||
for __brew_pkg in $__brew_pkgs
|
||||
if not contains $__brew_pkg $__brew_deps
|
||||
echo $__brew_pkg
|
||||
end
|
||||
end
|
||||
end
|
7
fish/functions/brew_remove.fish
Normal file
7
fish/functions/brew_remove.fish
Normal file
@ -0,0 +1,7 @@
|
||||
function brew_remove --description "Select homebrew packages to remove"
|
||||
set --local pkgs (brew leaves | eval "fzf $FZF_DEFAULT_OPTS --multi --header='[brew:uninstall]'")
|
||||
|
||||
if not test (count $pkgs) = 0
|
||||
brew uninstall $pkgs
|
||||
end
|
||||
end
|
7
fish/functions/brew_search.fish
Normal file
7
fish/functions/brew_search.fish
Normal file
@ -0,0 +1,7 @@
|
||||
function brew_search --description "Find homebrew packages to install"
|
||||
set --local pkgs (brew search | eval "fzf $FZF_DEFAULT_OPTS --multi --header='[brew:install]'")
|
||||
|
||||
if not test (count $pkgs) = 0
|
||||
brew install $pkgs
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user