dotfiles/.zsh/configs/functions.zsh
2021-06-10 12:18:43 +01:00

43 lines
843 B
Bash

function m() {
if [[ -f .notes/Makefile ]];
then
make -f .notes/Makefile "$@"
else
make "$@"
fi
}
function mkd() {
mkdir -p "$@" && cd "$@"
}
function db {
if [ "$1" = "refresh" ]; then
mysql -uroot -e "drop database $2; create database $2"
elif [ "$1" = "create" ]; then
mysql -uroot -e "create database $2"
elif [ "$1" = "drop" ]; then
mysql -uroot -e "drop database $2"
fi
}
is_linux() { [[ "$(uname)" == 'Linux' ]] }
is_macos() { [[ "$(uname)" == "Darwin" ]] }
function composer() {
docker run -u $UID -it --rm \
-v $(pwd):/app \
-v ~/.composer:/root/.composer \
-v ~/.ssh:/root/.ssh \
composer \
composer $*
}
# Run 'phpunit' or 'pest' depending on the project.
function p () {
vendor/bin/$(phpunit-or-pest) $*;
}
function pf () {
vendor/bin/$(phpunit-or-pest) --filter $*
}