2013-03-22 10:15:50 -07:00
|
|
|
function is_deb {
|
|
|
|
command_exists apt-get
|
|
|
|
}
|
|
|
|
|
|
|
|
function is_mac {
|
|
|
|
[[ $(uname) == 'Darwin' ]]
|
|
|
|
}
|
|
|
|
|
|
|
|
function is_linux {
|
|
|
|
[[ $(uname) == 'Linux' ]]
|
|
|
|
}
|
|
|
|
|
|
|
|
if is_mac; then
|
|
|
|
|
2013-10-26 08:50:05 -07:00
|
|
|
# Change working directory to the top-most Finder window location
|
|
|
|
function cdf() { # short for `cdfinder`
|
|
|
|
cd "$(osascript -e 'tell app "Finder" to POSIX path of (insertion location as alias)')"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Open a file in Mac OS's quick-look
|
|
|
|
function quicklook {
|
|
|
|
(( $# > 0 )) && qlmanage -p $* &>/dev/null &
|
|
|
|
}
|
|
|
|
|
2013-10-21 03:45:56 -07:00
|
|
|
# Check to see if the (mac) app exists
|
|
|
|
function app_exists {
|
|
|
|
[ -d /Applications/"$1" ] || [ -e /Applications/"$1".app ] || [ -e ~/Applications/"$1".app ]
|
|
|
|
}
|
|
|
|
|
2013-10-26 08:50:05 -07:00
|
|
|
function pkg_install() {
|
|
|
|
brew install $1
|
|
|
|
}
|
2013-10-18 06:53:01 -07:00
|
|
|
|
2013-10-26 08:50:05 -07:00
|
|
|
function pkg_remove() {
|
|
|
|
brew remove $1
|
|
|
|
}
|
2013-10-18 06:53:01 -07:00
|
|
|
|
2013-10-26 08:50:05 -07:00
|
|
|
function pkg_update() {
|
|
|
|
brew update && brew upgrade
|
|
|
|
}
|
2013-03-22 10:15:50 -07:00
|
|
|
|
|
|
|
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-03-22 10:15:50 -07:00
|
|
|
}
|
|
|
|
|
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-03-22 10:15:50 -07:00
|
|
|
}
|
|
|
|
|
2013-10-18 04:03:28 -07:00
|
|
|
function pkg_update() {
|
2013-03-22 10:15:50 -07:00
|
|
|
sudo apt-get update && sudo apt-get upgrade
|
|
|
|
}
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
2013-03-22 18:10:59 -07:00
|
|
|
# vim:set ft=zsh:
|