helm/zsh/lib/os

65 lines
1 KiB
Plaintext
Raw Normal View History

function is_deb {
command_exists apt-get
}
function is_mac {
[[ $(uname) == 'Darwin' ]]
}
function is_linux {
[[ $(uname) == 'Linux' ]]
}
if is_mac; then
if command_exists brew; then
function pkg_install() {
brew install $1
}
function pkg_remove() {
brew remove $1
}
function pkg_update() {
brew update && brew upgrade
}
else
function pkg_install() {
echo_r "Homebrew not installed"
exit 1
}
function pkg_remove() {
echo_r "Homebrew not installed"
exit 1
}
function pkg_update() {
echo_r "Homebrew not installed"
exit 1
}
fi
elif is_deb; then
2013-10-18 04:03:28 -07:00
function pkg_install() {
2013-05-05 15:14:07 -07:00
sudo apt-get -y install $1
}
2013-10-18 04:03:28 -07:00
function pkg_remove() {
2013-05-05 15:14:07 -07:00
sudo apt-get -y remove $1
}
2013-10-18 04:03:28 -07:00
function pkg_update() {
sudo apt-get update && sudo apt-get upgrade
}
fi
2013-03-22 18:10:59 -07:00
# vim:set ft=zsh: