prevent saving a package to brewfile more than once
This commit is contained in:
parent
6c8ad31e63
commit
0dcaf34739
1 changed files with 9 additions and 3 deletions
|
@ -6,10 +6,16 @@ function brew-save -d "Install a new homebrew cask and update the global Brewfil
|
|||
else
|
||||
set -f brewfile_keyword brew
|
||||
end
|
||||
echo "$brewfile_keyword \"$package\"" >> ~/.Brewfile
|
||||
brew bundle --global
|
||||
set -l brewfile_line "$brewfile_keyword \"$package\""
|
||||
if grep $brewfile_line ~/.Brewfile &> /dev/null
|
||||
echo "package already in ~/.Brewfile: $package"
|
||||
return 1
|
||||
else
|
||||
echo "$brewfile_keyword \"$package\"" >> ~/.Brewfile
|
||||
brew bundle --global
|
||||
end
|
||||
else
|
||||
echo "package not found: $argv"
|
||||
echo "package not found: $package"
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue