dotfiles/.zsh/configs/functions.zsh

43 lines
843 B
Bash
Raw Normal View History

function m() {
if [[ -f .notes/Makefile ]];
then
make -f .notes/Makefile "$@"
else
make "$@"
fi
}
2019-03-22 16:27:06 +00:00
function mkd() {
mkdir -p "$@" && cd "$@"
}
2019-08-30 18:49:19 +00:00
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
}
2020-06-09 20:22:35 +00:00
is_linux() { [[ "$(uname)" == 'Linux' ]] }
is_macos() { [[ "$(uname)" == "Darwin" ]] }
2020-07-30 00:17:38 +00:00
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 $*
}