56 lines
1.1 KiB
Bash
56 lines
1.1 KiB
Bash
|
||
function print_info() {
|
||
echo -e "[\\033[36mINFO\\033[0m] $@"
|
||
}
|
||
function print_ok() {
|
||
echo -e "[\\033[32mOK\\033[0m] $@"
|
||
}
|
||
function print_warning() {
|
||
echo -e "[\\033[33mWARNING\\033[0m] $@"
|
||
}
|
||
function print_error() {
|
||
echo -e "[\\033[32mERROR\\033[0m] $@"
|
||
}
|
||
|
||
function brewget()
|
||
{
|
||
# Install software using homebrew
|
||
# if not already installed
|
||
local brewname=$(basename $1)
|
||
|
||
if ! brew list | grep ${brewname} >/dev/null; then
|
||
print_info "Brewing ${brewname}"
|
||
brew install "$@"
|
||
fi
|
||
}
|
||
function caskget()
|
||
{
|
||
# Install OSX application using homebrew cask
|
||
# if not already installed
|
||
local caskname=$(basename $1)
|
||
|
||
if ! brew cask list | grep ${caskname} >/dev/null; then
|
||
print_info "Installing ${caskname} from cask"
|
||
brew cask install "$@"
|
||
fi
|
||
}
|
||
|
||
function linkfile()
|
||
{
|
||
local source=$1
|
||
local target=$2
|
||
|
||
if [ ! -e ${target} ]; then
|
||
print_info "Symlinking ${source} <- ${target}"
|
||
rm -rf ${target}
|
||
ln -s ${source} ${target}
|
||
fi
|
||
}
|
||
function makedir()
|
||
{
|
||
if [ ! -d $@ ]; then
|
||
print_info "Making directory $@"
|
||
mkdir $@
|
||
fi
|
||
}
|