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
|
else
|
||||||
set -f brewfile_keyword brew
|
set -f brewfile_keyword brew
|
||||||
end
|
end
|
||||||
echo "$brewfile_keyword \"$package\"" >> ~/.Brewfile
|
set -l brewfile_line "$brewfile_keyword \"$package\""
|
||||||
brew bundle --global
|
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
|
else
|
||||||
echo "package not found: $argv"
|
echo "package not found: $package"
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue